没有 [org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping] 类型的合格 bean
No qualifying bean of type [org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping]
我有一个配置了 swagger 的 spring 启动应用程序。我收到错误 运行 黄瓜测试。以下是配置:
@Configuration
@EnableSwagger2
@EnableWebMvc
public class SwaggerConfig {
}
@Category(IntegrationTest.class)
@RunWith(Cucumber.class)
@ContextConfiguration("classpath:cucumber-spring-beans.xml")
@CucumberOptions(snippets = SnippetType.CAMELCASE, strict = true, monochrome = true, tags = {"~@ManualTest", "~@SlowTest", "~@IgnoreTest", "~@AdHoc", "@IntegrationTest"},
features = {CucumberRunnerUtil.CukeFormat.FEATURE_FILE_LOCATION},
plugin = {"pretty", CucumberRunnerUtil.CukeFormat.CD_HTML_REPORT_INTEGRATION,
CucumberRunnerUtil.CukeFormat.CD_JSON_RESULTS_INTEGRATION + "integration-test-reports.json",
CucumberRunnerUtil.CukeFormat.CD_JUNIT_XML_REPORT_INTEGRATION + "integration-test-reports.xml"})
public class RunIntegrationCukeTest {
}
黄瓜-spring-beans.xml:
<context:component-scan base-package="org.springframework.samples.mvc" />
<context:annotation-config/>
<context:annotation-config/>
<mvc:annotation-driven/>
<context:component-scan base-package="com...." >
<context:exclude-filter type="assignable" expression="com...."/>
</context:component-scan>
<context:component-scan base-package="com...." >
</context:component-scan>
从 cucumber-spring-beans.xml 中排除与 swagger 相关的 Java 配置 类 成功了:
<context:component-scan base-package="...webservice.resource" >
<context:exclude-filter type="assignable" expression="...webservice.resource.Application"/>
<context:exclude-filter type="assignable" expression="...webservice.resource.SwaggerConfig"/>
<context:exclude-filter type="assignable" expression="...webservice.resource.JerseyConfig"/>
<context:exclude-filter type="assignable" expression="...webservice.resource.CombinedResourceProvider"/>
</context:component-scan>
我有一个配置了 swagger 的 spring 启动应用程序。我收到错误 运行 黄瓜测试。以下是配置:
@Configuration
@EnableSwagger2
@EnableWebMvc
public class SwaggerConfig {
}
@Category(IntegrationTest.class)
@RunWith(Cucumber.class)
@ContextConfiguration("classpath:cucumber-spring-beans.xml")
@CucumberOptions(snippets = SnippetType.CAMELCASE, strict = true, monochrome = true, tags = {"~@ManualTest", "~@SlowTest", "~@IgnoreTest", "~@AdHoc", "@IntegrationTest"},
features = {CucumberRunnerUtil.CukeFormat.FEATURE_FILE_LOCATION},
plugin = {"pretty", CucumberRunnerUtil.CukeFormat.CD_HTML_REPORT_INTEGRATION,
CucumberRunnerUtil.CukeFormat.CD_JSON_RESULTS_INTEGRATION + "integration-test-reports.json",
CucumberRunnerUtil.CukeFormat.CD_JUNIT_XML_REPORT_INTEGRATION + "integration-test-reports.xml"})
public class RunIntegrationCukeTest {
}
黄瓜-spring-beans.xml:
<context:component-scan base-package="org.springframework.samples.mvc" />
<context:annotation-config/>
<context:annotation-config/>
<mvc:annotation-driven/>
<context:component-scan base-package="com...." >
<context:exclude-filter type="assignable" expression="com...."/>
</context:component-scan>
<context:component-scan base-package="com...." >
</context:component-scan>
从 cucumber-spring-beans.xml 中排除与 swagger 相关的 Java 配置 类 成功了:
<context:component-scan base-package="...webservice.resource" >
<context:exclude-filter type="assignable" expression="...webservice.resource.Application"/>
<context:exclude-filter type="assignable" expression="...webservice.resource.SwaggerConfig"/>
<context:exclude-filter type="assignable" expression="...webservice.resource.JerseyConfig"/>
<context:exclude-filter type="assignable" expression="...webservice.resource.CombinedResourceProvider"/>
</context:component-scan>