mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
完善
This commit is contained in:
11
pom.xml
11
pom.xml
@@ -51,6 +51,17 @@
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-quartz -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.bitwalker</groupId>
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
|
||||
@@ -18,16 +18,4 @@ import java.util.concurrent.Executor;
|
||||
public class AsyncConfig implements AsyncConfigurer {
|
||||
|
||||
|
||||
@Override
|
||||
public Executor getAsyncExecutor() {
|
||||
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
|
||||
threadPoolTaskExecutor.initialize();
|
||||
return threadPoolTaskExecutor;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
|
||||
return (ex, method, params) -> log.info("异步方法异常:\nmethod: {}\nparams: {}", method.toString(), Arrays.toString(params), ex);
|
||||
}
|
||||
}
|
||||
|
||||
23
src/main/java/cn/lihongjie/coal/config/CacheConfig.java
Normal file
23
src/main/java/cn/lihongjie/coal/config/CacheConfig.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package cn.lihongjie.coal.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.cache.RedisCacheManagerBuilderCustomizer;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@EnableCaching
|
||||
@Configuration
|
||||
public class CacheConfig {
|
||||
@Bean
|
||||
public RedisCacheManagerBuilderCustomizer myRedisCacheManagerBuilderCustomizer() {
|
||||
return new RedisCacheManagerBuilderCustomizer() {
|
||||
@Override
|
||||
public void customize(org.springframework.data.redis.cache.RedisCacheManager.RedisCacheManagerBuilder builder) {
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
12
src/main/java/cn/lihongjie/coal/job/DemoJob.java
Normal file
12
src/main/java/cn/lihongjie/coal/job/DemoJob.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package cn.lihongjie.coal.job;
|
||||
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
|
||||
public class DemoJob extends QuartzJobBean {
|
||||
@Override
|
||||
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,28 @@ spring:
|
||||
validation-query-timeout: 1000
|
||||
test-on-borrow: true
|
||||
test-on-return: true
|
||||
enable: true
|
||||
enable: true
|
||||
task:
|
||||
execution:
|
||||
pool:
|
||||
max-size: 20
|
||||
queue-capacity: 1000
|
||||
thread-name-prefix: task-
|
||||
scheduling:
|
||||
thread-name-prefix: schedule-
|
||||
data:
|
||||
redis:
|
||||
host: localhost
|
||||
port: 6379
|
||||
password: 'abc@123'
|
||||
|
||||
cache:
|
||||
type: redis
|
||||
redis:
|
||||
enable-statistics: true
|
||||
quartz:
|
||||
auto-startup: true
|
||||
job-store-type: jdbc
|
||||
overwrite-existing-jobs: true
|
||||
wait-for-jobs-to-complete-on-shutdown: true
|
||||
startup-delay: 5
|
||||
|
||||
10
src/main/resources/logback-spring.xml
Normal file
10
src/main/resources/logback-spring.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<configuration>
|
||||
<springProfile name="dev | test">
|
||||
<!-- configuration to be enabled when the "dev" or "staging" profiles are active -->
|
||||
<include ></include>
|
||||
</springProfile>
|
||||
|
||||
<springProfile name="production">
|
||||
<!-- configuration to be enabled when the "production" profile is not active -->
|
||||
</springProfile>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user