'CXF web services and multiple endpoints for service

I'm new to the CXF and JAX-WS using with Spring Boot. So far I have a service with one endpoint but as next I want to add another endpoint to the same service by publishing new endpoint as

@Configuration
public class CXFSvcConfig
{
    @Autowired
    protected Bus bus;
    
   @Bean
   @ConditionalOnMissingBean
   public Service mySvc()
   {
      return new Service();
   }


   @Bean
    @ConditionalOnMissingBean    
    public Endpoint testService1()
    {
        final EndpointImpl endpoint = new EndpointImpl(bus, mySvc());
        endpoint.publish("/Service1");
        return endpoint;
    }

   @Bean
   @ConditionalOnMissingBean
   public Endpoint testService2()
   {
      final EndpointImpl endpoint2 = new EndpointImpl(bus, mySvc());
      endpoint2.publish("/Service2");
      return endpoint2;
   }
}

/Service1 endpoint will work fine (will display WSDL) but /Service2 will throw Service not found when I will expect to see the same WSDL as is for /Service1

What am I doing wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source