我有以下代码但它不起作用。 CXF报告未找到任何服务,如果我直接通过http://domain:8080/api/cxf/LotService
访问它,我会收到“未找到服务”。我在Tomcat中使用最新的CXF和Spring 4.
@Configuration
@ImportResource({ "classpath:META-INF/cxf/cxf.xml" })
public class CXFConfiguration {
@Autowired
ILotService lotService;
@Bean
public Endpoint lotService() {
EndpointImpl endpoint = new EndpointImpl(SpringBusFactory.getDefaultBus(), lotService);
endpoint.setAddress("/LotService");
endpoint.publish();
return endpoint;
}
答案 0 :(得分:1)
正确的配置在这里
@Configuration
@Order(3)
@ImportResource({ "classpath:META-INF/cxf/cxf.xml" })
public class CXFConfiguration {
@Autowired
Bus cxfBus;
@Bean
public Endpoint lotServiceEndpointWS() {
EndpointImpl endpoint = new EndpointImpl(this.cxfBus,
new LotServiceEndpoint());
endpoint.setAddress("/LotService");
endpoint.publish();
return endpoint;
}