小编Pra*_*cer的帖子

在Spring单元测试期间无法加载ApplicationContext

我正在尝试使用Springs java-config为我的应用程序上下文运行Junit功能测试.我不确定它是否是Spring或Junit的问题...只是不确定..应用程序在我的本地服务器上运行正常(击中数据库),但是当我尝试运行我的测试时它会爆炸.我刚刚从xml移动到java配置,所以我总是可以导入我的xml上下文文件(我知道在我的测试中可以工作),但是我想继续使用我的java配置.

我的测试班

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = AnnotationConfigContextLoader.class,
        classes = { AppConfig.class, ServletConfig.class })
@EnvironmentConfiguration(db2Enabled = true)
public class EventDAOTest {
Run Code Online (Sandbox Code Playgroud)

StackTrace

Feb 4, 2014 11:51:45 AM com.aoins.config.CachingPropertyFileReader <clinit>
SEVERE: ERROR - Configuration Framework not detected!
Feb 4, 2014 11:51:45 AM com.aoins.config.CachingPropertyFileReader readFile
SEVERE: Unable to build property reference for: (common).
2014-02-04 11:51:45,510 | DEBUG |         : | LoggerConfigurer | Msg: Log4j configured with: 'C:/javalog/log4jPCProperties.xml'
2014-02-04 11:51:48,248 | INFO  |         : | EnvironmentConfigurer | Msg: DB2 Connection was established
2014-02-04 11:51:48,279 …
Run Code Online (Sandbox Code Playgroud)

spring junit4 spring-java-config

33
推荐指数
4
解决办法
5万
查看次数

标签 统计

junit4 ×1

spring ×1

spring-java-config ×1