我使用spring-boot-starter-thymeleaf和STS創建了一個簡單的彈簧mvc應用程序。現在我想添加一個異步任務,並且需要添加org.springframework.scheduling.concurrent作爲依賴項。確切的錯誤信息是如何將org.springframework.scheduling.concurrent添加到spring啓動pom.xml文件中?
org.springframework.beans.factory.NoSuchBeanDefinitionException:無類型 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] 發現依賴 排位豆:預期至少1豆,其有資格成爲 autowire這個依賴關係的候選人。依賴註釋: {@ org.springframework.beans.factory.annotation.Autowired(必需=真)}
請幫我弄清楚如何添加缺少的依賴。
我的pom.xml如下:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.demo.demoweb</groupId>
<artifactId>demoweb</artifactId>
<version>0.1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
謝謝你的回答。這個解決方案適用於我。 – danatel