春季启动ManagedExecutorService实例

时间:2018-10-08 10:37:01

标签: java multithreading spring-boot tomcat

我们正在创建一个新的Spring Boot项目,其中一部分需要多线程操作。我们正在尝试使用ManagedExecutorService,因此我们将其声明如下:

@Resource(name="java:comp/DefaultManagedExecutorService")  
private ManagedExecutorService mes;  

在执行过程中返回错误:

Injection of resource dependencies failed; nested exception is 
org.springframework.beans.factory.BeanDefinitionStoreException: 
Invalid bean definition with name 'java:comp/DefaultManagedExecutorService' defined in JNDI environment: JNDI lookup failed; nested exception is 
javax.naming.NoInitialContextException: Need to specify class name in 
environment or system property, or as an applet parameter, or in an 
application resource file:  java.naming.factory.initial

这是否意味着Spring Boot不支持/不允许我们在tomcat中使用ManagedExecutorService?

0 个答案:

没有答案