mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-26 17:35:49 +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>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- adding redis client library -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Databases - Uses H2 by default -->
|
<!-- Databases - Uses H2 by default -->
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# database init, supports mysql too
|
# database init, supports mysql too
|
||||||
database=mysql
|
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.username=${MYSQL_USER:root}
|
||||||
spring.datasource.password=${MYSQL_PASS:Tech@123}
|
spring.datasource.password=${MYSQL_PASS:Tech@123}
|
||||||
# SQL is written to be idempotent so this is safe
|
# SQL is written to be idempotent so this is safe
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
# database init, supports mysql too
|
# database init, supports mysql too
|
||||||
database=h2
|
# database=h2
|
||||||
spring.sql.init.schema-locations=classpath*:db/${database}/schema.sql
|
# spring.sql.init.schema-locations=classpath*:db/${database}/schema.sql
|
||||||
spring.sql.init.data-locations=classpath*:db/${database}/data.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
|
# Web
|
||||||
spring.thymeleaf.mode=HTML
|
spring.thymeleaf.mode=HTML
|
||||||
|
|
||||||
# JPA
|
# JPA
|
||||||
spring.jpa.hibernate.ddl-auto=none
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
spring.jpa.open-in-view=true
|
spring.jpa.open-in-view=true
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
|
@ -23,3 +28,6 @@ logging.level.org.springframework=INFO
|
||||||
|
|
||||||
# Maximum time static resources should be cached
|
# Maximum time static resources should be cached
|
||||||
spring.web.resources.cache.cachecontrol.max-age=12h
|
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