我正在尝试使用Spring's Getting Started guides
之一(使用Maven
)并且我遇到Produce a Web Service
个问题。
此处指南的链接https://spring.io/guides/gs/producing-web-service/
出于某种原因,我不断收到错误:
The method setApplicationContext(ApplicationContext) is undefined for the type MessageDispatcherServlet
关于以下代码:
public class WebServiceConfig extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/ws/*");
}
我检查了API参考,MessageDispatcherServlet
应该从setApplicationContext
继承FrameworkServlet
,但由于某种原因它不存在。
非常感谢任何帮助。