小编Ron*_*Ron的帖子

无法实例化工厂类:org.springframework.boot.autoconfigure.AutoConfigurationImportFilter"在Tomcat上运行Spring Boot应用程序时

我是Spring Boot的新手.刚刚在官方网站上的Spring Boot Tutorial之后构建了Spring Boot示例,然后使用WAR格式部署在Tomcat上,在开始运行时得到如下错误:

2017-03-01 09:26:17.838  INFO 12568 --- [ost-startStop-1] hello.SpringBootWebApplicationTest       : No active profile set, falling back to default profiles: default
2017-03-01 09:26:18.116  INFO 12568 --- [ost-startStop-1] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3c164927: startup date [Wed Mar 01 09:26:18 CST 2017]; root of context hierarchy
2017-03-01 09:26:19.015  WARN 12568 --- [ost-startStop-1] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [hello.SpringBootWebApplicationTest]; nested exception is java.lang.IllegalArgumentException: Cannot instantiate factory class: …
Run Code Online (Sandbox Code Playgroud)

spring tomcat maven spring-boot

14
推荐指数
1
解决办法
1万
查看次数

JUnit testing got initializationError with java.lang.Exception: No tests found matching

When running JUnit testing , it gave an initializationError: No tests found matching. Like this:

prodapi-main-junit
initializationError(org.junit.runner.manipulation.Filter)
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testCreateSite], {ExactMatcher:fDisplayName=testCreateSite(com.company.product.api.web.rest.HostControllerTest)], {LeadingIdentifierMatcher:fClassName=com.company.product.api.web.rest.HostControllerTest,fLeadingIdentifier=testCreateSite]] from org.junit.internal.requests.ClassRequest@3c0f93f1
    at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:40)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:77)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:68)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Run Code Online (Sandbox Code Playgroud)

While the testing code is as below:

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ProductApplication.class)
@WebAppConfiguration
public class HostControllerTest{
    @Test
    public void testCreateSite() throws Exception {
    ......
}
}
Run Code Online (Sandbox Code Playgroud)

It should be fine to load the class, running well. There're other …

junit spring unit-testing

6
推荐指数
2
解决办法
2万
查看次数

标签 统计

spring ×2

junit ×1

maven ×1

spring-boot ×1

tomcat ×1

unit-testing ×1