简体   繁体   中英

CXF and Spring configured but CXF reports 'no services found'

I have the following code and it doesn't work. CXF reports that no services are found and if I access it directly by http://domain:8080/api/cxf/LotService , I get 'No service was found'. I'm using the latest CXF and Spring 4 in Tomcat.

@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;
    }

The proper configuration is here

@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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM