mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-26 01:15:50 +00:00
redis cache setup
This commit is contained in:
parent
625f488a57
commit
6f4c49a95e
3 changed files with 19 additions and 6 deletions
5
pom.xml
5
pom.xml
|
@ -59,6 +59,11 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- adding redis client library -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Databases - Uses H2 by default -->
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# database init, supports mysql too
|
||||
database=mysql
|
||||
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost/petclinic}
|
||||
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost:3306/petclinic}
|
||||
spring.datasource.username=${MYSQL_USER:root}
|
||||
spring.datasource.password=${MYSQL_PASS:Tech@123}
|
||||
# SQL is written to be idempotent so this is safe
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
# database init, supports mysql too
|
||||
database=h2
|
||||
spring.sql.init.schema-locations=classpath*:db/${database}/schema.sql
|
||||
spring.sql.init.data-locations=classpath*:db/${database}/data.sql
|
||||
|
||||
# database=h2
|
||||
# spring.sql.init.schema-locations=classpath*:db/${database}/schema.sql
|
||||
# spring.sql.init.data-locations=classpath*:db/${database}/data.sql
|
||||
database=mysql
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/petclinic
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=Tech@123
|
||||
# SQL is written to be idempotent so this is safe
|
||||
spring.sql.init.mode=always
|
||||
# Web
|
||||
spring.thymeleaf.mode=HTML
|
||||
|
||||
# JPA
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.open-in-view=true
|
||||
|
||||
# Internationalization
|
||||
|
@ -23,3 +28,6 @@ logging.level.org.springframework=INFO
|
|||
|
||||
# Maximum time static resources should be cached
|
||||
spring.web.resources.cache.cachecontrol.max-age=12h
|
||||
# configure the Redis connection settings
|
||||
spring.redis.host=localhost
|
||||
spring.redis.port=6379
|
Loading…
Reference in a new issue