diff --git a/build.gradle b/build.gradle index b2d46f7..50beec6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ //file:noinspection SpellCheckingInspection +//file:noinspection VulnerableLibrariesLocal buildscript { repositories { // Use Maven Central for resolving dependencies. @@ -227,6 +228,19 @@ dependencies { // in Spring applications. It allows developers to manage transactions declarative or programmatically, // ensuring data consistency and integrity across various transactional operations. implementation 'org.springframework:spring-tx:5.3.25' + // The "spring-data-redis" library, version 2.7.8, is a Spring Data module that provides easy configuration and access to Redis from Spring applications, + // offering comprehensive support for Redis operations, including connection management, RedisTemplate, and repository support for Spring Data. + implementation group: 'org.springframework.data', name: 'spring-data-redis', version: '2.7.8' + // The "spring-integration-redis" library, version 5.5.20, is a Spring Integration module that provides support for Redis-based messaging, + // enabling integration with Redis to send and receive messages, as well as leveraging Redis Pub/Sub capabilities within Spring applications. + // Using runtimeOnly to ensure this dependency is only included at runtime. + runtimeOnly group: 'org.springframework.integration', name: 'spring-integration-redis', version: '5.5.20' + // The "lettuce-core" library, version 6.2.3.RELEASE, is a powerful and thread-safe Redis client for Java, + // providing asynchronous, synchronous, and reactive API support to efficiently interact with Redis servers. + implementation group: 'io.lettuce', name: 'lettuce-core', version: '6.2.3.RELEASE' + // The "jedis" library, version 5.1.3, is a simple and feature-rich Java client for Redis, + // providing synchronous and asynchronous communication with Redis servers to perform various operations and transactions. + implementation group: 'redis.clients', name: 'jedis', version: '5.1.3' } tasks.named('test') { diff --git a/gradle.yml b/gradle.yml index 05b7062..c114969 100644 --- a/gradle.yml +++ b/gradle.yml @@ -6,3 +6,4 @@ ng: - source: "libs/unify4j-v1.0.0.jar" - source: "libs/force4j-v1.0.0.jar" - source: "libs/botwrap4j-v1.0.0.jar" + - source: "libs/redis4j-v1.0.0.jar" diff --git a/libs/redis4j-v1.0.0.jar b/libs/redis4j-v1.0.0.jar new file mode 100644 index 0000000..a8f74c0 Binary files /dev/null and b/libs/redis4j-v1.0.0.jar differ diff --git a/libs/unify4j-v1.0.0.jar b/libs/unify4j-v1.0.0.jar index 7581043..5831035 100644 Binary files a/libs/unify4j-v1.0.0.jar and b/libs/unify4j-v1.0.0.jar differ diff --git a/src/main/java/com/suit4j/app/AppApplication.java b/src/main/java/com/suit4j/app/AppApplication.java index 2329a75..e04edd3 100644 --- a/src/main/java/com/suit4j/app/AppApplication.java +++ b/src/main/java/com/suit4j/app/AppApplication.java @@ -6,7 +6,7 @@ @SuppressWarnings({"SpellCheckingInspection"}) @SpringBootApplication -@ComponentScan(basePackages = {"com.suit4j.app", "org.force4j", "org.botwrap4j"}) +@ComponentScan(basePackages = {"com.suit4j.app", "org.force4j", "org.botwrap4j", "org.redis4j"}) public class AppApplication { public static void main(String[] args) { diff --git a/src/main/java/com/suit4j/app/controllers/CommonController.java b/src/main/java/com/suit4j/app/controllers/CommonController.java index fb532c8..12b805c 100644 --- a/src/main/java/com/suit4j/app/controllers/CommonController.java +++ b/src/main/java/com/suit4j/app/controllers/CommonController.java @@ -1,6 +1,8 @@ package com.suit4j.app.controllers; +import com.suit4j.app.services.CommonService; import org.force4j.common.Force4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -11,6 +13,12 @@ @RestController @RequestMapping(value = "/api/v1/common") public class CommonController extends BaseController { + protected final CommonService commonService; + + @Autowired + public CommonController(CommonService commonService) { + this.commonService = commonService; + } @GetMapping("/health") public @ResponseBody ResponseEntity inform() { diff --git a/src/main/java/com/suit4j/app/services/.gitkeep b/src/main/java/com/suit4j/app/services/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/java/com/suit4j/app/services/CommonService.java b/src/main/java/com/suit4j/app/services/CommonService.java new file mode 100644 index 0000000..f2182f2 --- /dev/null +++ b/src/main/java/com/suit4j/app/services/CommonService.java @@ -0,0 +1,4 @@ +package com.suit4j.app.services; + +public interface CommonService { +} diff --git a/src/main/java/com/suit4j/app/services/impl/.gitkeep b/src/main/java/com/suit4j/app/services/impl/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/java/com/suit4j/app/services/impl/CommonServiceImpl.java b/src/main/java/com/suit4j/app/services/impl/CommonServiceImpl.java new file mode 100644 index 0000000..d114c39 --- /dev/null +++ b/src/main/java/com/suit4j/app/services/impl/CommonServiceImpl.java @@ -0,0 +1,12 @@ +package com.suit4j.app.services.impl; + +import com.suit4j.app.services.CommonService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +@SuppressWarnings({"FieldCanBeLocal", "DuplcatedCode"}) +@Service +public class CommonServiceImpl implements CommonService { + protected static final Logger logger = LoggerFactory.getLogger(CommonServiceImpl.class); +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index d7e6c6f..d5f2953 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,7 +1,41 @@ +# ################################ +# Spring Redis4J Config +# 2024-06-16 10:48:54 +# ################################ +spring: + # noinspection SpellCheckingInspection + redis4j: # Redis4J specific configuration + enabled: false # Toggle to enable or disable Redis4J + debugging: false # Toggle debugging for Redis4J + test_on_borrow: true # Test the connection on borrowing from the pool + test_on_return: true # Test the connection on returning to the pool + test_while_idle: true # Test the connection while idle in the pool + block_when_exhausted: true # Block when the connection pool is exhausted + shared_native_connection: true # Enable sharing of native connections across multiple clients + num_tests_per_eviction_run: 3 # Number of tests to run on eviction + duration_between_eviction_runs: 30s # Time between eviction runs + # The maximum amount of time a Redis command (or operation) can take before it is considered to have timed out. + # This timeout ensures that if a Redis command execution exceeds this duration, + # the client library will abort the operation and throw a timeout exception. + execution_command_timeout: 100ms + redis: # Configuration for the Redis connection + database: 0 # The database index to use (default is 0) + host: 127.0.0.1 # The host where the Redis server is running + port: 6379 # The port on which the Redis server is listening + password: "****" # Optional password to authenticate with Redis (if required) + timeout: 2000ms # The timeout value for connecting to Redis + jedis: # Configuration for connection pooling with Jedis + pool: + max-active: 8 # Maximum number of connections in the Jedis pool + max-idle: 8 # Maximum number of idle connections in the Jedis pool + min-idle: 0 # Minimum number of idle connections in the Jedis pool + max-wait: -1ms # Maximum wait time for a connection from the Jedis pool + # ################################ # Spring BotWrap4j Config # 2024-06-16 10:48:54 # ################################ +--- spring: # noinspection SpellCheckingInspection botwrap4j: diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index 302204c..6b46baa 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -8,6 +8,40 @@ spring: - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration # disable the DataSource autoconfiguration - org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration # disable the Security autoconfiguration +# ################################ +# Spring Redis4J Config +# 2024-06-16 10:48:54 +# ################################ +--- +spring: + # noinspection SpellCheckingInspection + redis4j: # Redis4J specific configuration + enabled: false # Toggle to enable or disable Redis4J + debugging: true # Toggle debugging for Redis4J + test_on_borrow: true # Test the connection on borrowing from the pool + test_on_return: true # Test the connection on returning to the pool + test_while_idle: true # Test the connection while idle in the pool + block_when_exhausted: true # Block when the connection pool is exhausted + shared_native_connection: true # Enable sharing of native connections across multiple clients + num_tests_per_eviction_run: 3 # Number of tests to run on eviction + duration_between_eviction_runs: 30s # Time between eviction runs + # The maximum amount of time a Redis command (or operation) can take before it is considered to have timed out. + # This timeout ensures that if a Redis command execution exceeds this duration, + # the client library will abort the operation and throw a timeout exception. + execution_command_timeout: 100ms + redis: # Configuration for the Redis connection + database: 0 # The database index to use (default is 0) + host: 127.0.0.1 # The host where the Redis server is running + port: 6379 # The port on which the Redis server is listening + password: "****" # Optional password to authenticate with Redis (if required) + timeout: 2000ms # The timeout value for connecting to Redis + jedis: # Configuration for connection pooling with Jedis + pool: + max-active: 8 # Maximum number of connections in the Jedis pool + max-idle: 8 # Maximum number of idle connections in the Jedis pool + min-idle: 0 # Minimum number of idle connections in the Jedis pool + max-wait: -1ms # Maximum wait time for a connection from the Jedis pool + # ################################ # Spring BotWrap4j Config # 2024-06-16 10:48:54 diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index d7e6c6f..d5f2953 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -1,7 +1,41 @@ +# ################################ +# Spring Redis4J Config +# 2024-06-16 10:48:54 +# ################################ +spring: + # noinspection SpellCheckingInspection + redis4j: # Redis4J specific configuration + enabled: false # Toggle to enable or disable Redis4J + debugging: false # Toggle debugging for Redis4J + test_on_borrow: true # Test the connection on borrowing from the pool + test_on_return: true # Test the connection on returning to the pool + test_while_idle: true # Test the connection while idle in the pool + block_when_exhausted: true # Block when the connection pool is exhausted + shared_native_connection: true # Enable sharing of native connections across multiple clients + num_tests_per_eviction_run: 3 # Number of tests to run on eviction + duration_between_eviction_runs: 30s # Time between eviction runs + # The maximum amount of time a Redis command (or operation) can take before it is considered to have timed out. + # This timeout ensures that if a Redis command execution exceeds this duration, + # the client library will abort the operation and throw a timeout exception. + execution_command_timeout: 100ms + redis: # Configuration for the Redis connection + database: 0 # The database index to use (default is 0) + host: 127.0.0.1 # The host where the Redis server is running + port: 6379 # The port on which the Redis server is listening + password: "****" # Optional password to authenticate with Redis (if required) + timeout: 2000ms # The timeout value for connecting to Redis + jedis: # Configuration for connection pooling with Jedis + pool: + max-active: 8 # Maximum number of connections in the Jedis pool + max-idle: 8 # Maximum number of idle connections in the Jedis pool + min-idle: 0 # Minimum number of idle connections in the Jedis pool + max-wait: -1ms # Maximum wait time for a connection from the Jedis pool + # ################################ # Spring BotWrap4j Config # 2024-06-16 10:48:54 # ################################ +--- spring: # noinspection SpellCheckingInspection botwrap4j: