我无法访问网址http://localhost:8080/mn_webapp/CustomerService?wsdl
使用以下配置:
@Configuration
@ImportResource({ "classpath:META-INF/cxf/cxf.xml"})
public class ContextConfig extends SpringBootServletInitializer {
@Bean
public ServletRegistrationBean dispatcherServlet() {
return new ServletRegistrationBean(new CXFServlet(), "/*");
}
@Autowired
private Bus cxfBus;
@Bean
public EndpointImpl endpoint() {
EndpointImpl endpoint = new EndpointImpl(cxfBus, applicationContext.getBean(IWCustomerService.class) );
endpoint.publish("/CustomerService");
return endpoint;
}
}
和web.xml
<context-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>com.dev.core.init.ContextConfig</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
似乎从不调用dispatcherServlet()和endpoint()?