I am getting below error when creating a simple web service that returns "hello" string
Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.
My webservice endpoint:
@WebService
public class HelloWs {
@WebMethod
public String hello() {
return "hello";
}
}
My configuration class:
@Configuration
public class WebServiceConfig {
@Autowired
private Bus bus;
@Bean
public Endpoint endpoint() {
Endpoint endpoint = new EndpointImpl(bus, new HelloWs());
endpoint.publish("/hello");
return endpoint;
}
}
My pom.xml
dependencies:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.2.7</version>
</dependency>
</dependencies>
My project structure: