redis cache setup

This commit is contained in:
tenzin metok 2023-04-06 11:30:24 +05:30
parent 625f488a57
commit 6f4c49a95e
3 changed files with 19 additions and 6 deletions

View file

@ -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 -->

View file

@ -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

View file

@ -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