【发布时间】:2018-12-14 10:06:46
【问题描述】:
创建返回“hello”字符串的简单 Web 服务时出现以下错误
Whitelabel 错误页面 此应用程序没有明确的映射 /error,因此您将其视为后备。
我的网络服务端点:
@WebService
public class HelloWs {
@WebMethod
public String hello() {
return "hello";
}
}
我的配置类:
@Configuration
public class WebServiceConfig {
@Autowired
private Bus bus;
@Bean
public Endpoint endpoint() {
Endpoint endpoint = new EndpointImpl(bus, new HelloWs());
endpoint.publish("/hello");
return endpoint;
}
}
我的pom.xml 依赖项:
<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>
我的项目结构:
【问题讨论】:
标签: web-services spring-boot cxf spring-boot-maven-plugin