我的spring-boot微服务当前使用spring-boot 2.2.9运行。RELEASE
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
我仍然使用
- Spring Cloud Hoxton.SR7
- 春季云启动器侦探2.2.4
- 弹簧云启动器拉链2.2.4
- 弹簧套启动器数据休息2.2.9
- 弹簧套启动器石英2.2.9
- 弹簧引导配置处理器2.2.9
- 弹簧靴启动器腹板2.2.9
- springcloudstarter netflix eureka客户端2.2.4
- 弹簧套启动器执行器2.2.9
- 弹簧启动启动器数据jpa 2.2.9
- PostgreSQL
- Logstash 6.4
- 日志2.1.4
- 龙目1.18.12
依赖关系。
现在我想切换到SpringBoot2.3.2.RELEASE。我可以编译没有任何错误的代码。启动服务后,我看到这个
信息:HHH000490:使用JtaPlatform实现:[org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
日志消息。现在出现错误。然后部署过程停止了。什么也没发生。
目前我不知道它为什么不运行。有人给小费吗?
我想我发现了问题。
@EnableEurekaClient
@EnableScheduling
@SpringBootApplication
@EnableAsync
public class AccountApplication {
public static void main(String[] args) {
SpringApplication.run(AccountApplication.class, args);
}
@Bean("threadPoolTaskExecutor")
public Executor asyncExecutor() {
final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(20);
executor.setMaxPoolSize(1000);
executor.setThreadNamePrefix("AsyncThread-");
executor.initialize();
return executor;
}
}
我在代码中使用了Exceutor:
@Async("threadPoolTaskExecutor")
public CompletableFuture<ServiceAccountDTO> registerAccountInService(final String uuid, final ServiceEnum serviceEnum,
final Date creationDate, final Date realCreationDate) {
..
}
使用此配置时,服务未正确启动。
现在@Bean("threadPoolTaskExecutor"(配置被删除,我只使用@Async。
但为什么它不能与Spring Boot Starter 2.3.x配合使用呢?日志中没有错误消息。