refactor: move caching configuration to CacheConfig and update application.yml settings
This commit is contained in:
@@ -1,20 +1,16 @@
|
|||||||
package com.onixbyte.helix;
|
package com.onixbyte.helix;
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.cache.annotation.EnableCaching;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application entrance.
|
* Application entrance.
|
||||||
*
|
*
|
||||||
* @author zihluwang
|
* @author zihluwang
|
||||||
* @see SpringBootApplication
|
* @see SpringBootApplication
|
||||||
* @see EnableCaching
|
|
||||||
* @see SpringApplication
|
* @see SpringApplication
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
@EnableCaching
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class HelixApplication {
|
public class HelixApplication {
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.onixbyte.helix.config;
|
package com.onixbyte.helix.config;
|
||||||
|
|
||||||
import com.onixbyte.helix.extension.redis.serializer.JacksonSerialiser;
|
import com.onixbyte.helix.extension.redis.serializer.JacksonSerialiser;
|
||||||
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||||
@@ -34,6 +35,7 @@ import java.time.Duration;
|
|||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@EnableCaching
|
||||||
public class CacheConfig {
|
public class CacheConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ spring:
|
|||||||
cache:
|
cache:
|
||||||
type: redis
|
type: redis
|
||||||
redis:
|
redis:
|
||||||
time-to-live: PT1H30M
|
time-to-live: PT2H
|
||||||
jpa:
|
jpa:
|
||||||
properties:
|
properties:
|
||||||
hibernate:
|
hibernate:
|
||||||
@@ -19,6 +19,11 @@ spring:
|
|||||||
hikari:
|
hikari:
|
||||||
minimum-idle: 1
|
minimum-idle: 1
|
||||||
maximum-pool-size: 10
|
maximum-pool-size: 10
|
||||||
|
data:
|
||||||
|
redis:
|
||||||
|
repositories:
|
||||||
|
# Disable redis repositories
|
||||||
|
enabled: false
|
||||||
|
|
||||||
mybatis:
|
mybatis:
|
||||||
configuration:
|
configuration:
|
||||||
@@ -27,3 +32,8 @@ mybatis:
|
|||||||
type-aliases-package: com.onixbyte.helix.domain.entity
|
type-aliases-package: com.onixbyte.helix.domain.entity
|
||||||
type-handlers-package: com.onixbyte.helix.extension.mybatis.handler
|
type-handlers-package: com.onixbyte.helix.extension.mybatis.handler
|
||||||
mapper-locations: classpath:/mapper/*.xml
|
mapper-locations: classpath:/mapper/*.xml
|
||||||
|
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
org.hibernate:
|
||||||
|
orm.connections.pooling: off
|
||||||
|
|||||||
Reference in New Issue
Block a user