Search code examples
javaspringspring-bootweb-servicessoap

Parameter 0 of method getInfo in org.endpoint.EndpointConfig required a bean of type 'org.apache.cxf.Bus' that could not be found


I'am in a project spring boot with web service soap when i run my application i have this error


APPLICATION FAILED TO START


Description:

Parameter 0 of method getInfo in org.endpoint.EndpointConfig required a bean of type 'org.apache.cxf.Bus' that could not be found.

Action:

Consider defining a bean of type 'org.apache.cxf.Bus' in your configuration.

import org.service.MyService;
import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class EndpointConfig {
    @Bean
    public EndpointImpl getInfo(Bus bus, MyService service) {
        EndpointImpl endpoint = new EndpointImpl(bus, service);
        endpoint.publish("/info");
        return endpoint;
    }
}




@SpringBootApplication()
public class APIApplication{
    public static void main(String[] args) {
        new SpringApplicationBuilder(APIApplication.class).run(args);
    }

}

Solution

  • Parameter 0 of method getInfo in org.endpoint.EndpointConfig required a bean of type 'org.apache.cxf.Bus' that could not be found.

    The reason of this issue is that Spring Boot in your app could not find a bean of type org.apache.cxf.Bus, which is required by your getInfo method in EndpointConfig.

    I'am in a project spring boot with web service soap when i run my application i have this error

    I suggest to check if the appropriate CXF dependency is included in your pom.xml.

    If you already have this dependency, check if the CXF Bus bean is correctly configured. Spring Boot should configure it automatically, however you can manually define it:

    import org.apache.cxf.Bus;
    import org.apache.cxf.bus.spring.SpringBus;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    
    @Configuration
    public class CxfConfig {
    
        @Bean
        public SpringBus springBus() {
            return new SpringBus();
        }
    }
    

    Also I insist to check compatibility of your Spring Boot in your app with Apache CXF.