我的开发环境为:
ubuntu14.04LTS 64bit;
Spring Tool Suite 3.5.0.RELEASE
Maven 3.2.3
最终解决方法:更换spring版本
bug详情:
这几天一直在被这个bug虐。所有的配置文件我和类文件都检查了N遍了都没问题。可就是开启包扫描后就报bug,关掉报扫描就没bug了。
部分错误:
17:02:37,149 ERROR TestContextManager:315 - Caught exception while allowing TestExecutionListener [or[email protected]7692d9cc] to prepare test instance [[email protected]]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
经过排查最终将3.2.0.RELEASE更换为3.2.4.RELEASE问题解决。
<!-- spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.0.RELEASE</version>
</dependency> -->