Web Services 与ServletRegistrationBean的界限不匹配< MessageDispatcherServlet>

qcuzuvrc  于 2023-01-13  发布在  其他
关注(0)|答案(1)|浏览(146)

我尝试编写可返回MessageDispatcherServlet示例的ServletRegistrationBean方法,但遇到了界限不匹配错误。
这是我写的方法:

public ServletRegistrationBean<MessageDispatcherServlet> requestDispatcher (ApplicationContext conext){
        MessageDispatcherServlet msd = new MessageDispatcherServlet();
        msd.setApplicationContext(conext);
        msd.setTransformWsdlLocations(true);
servletContext.addServlet("MessageDispatcherServlet",msd);
        return new ServletRegistrationBean<MessageDispatcherServlet>(msd, "/soap/*");
    }

我做错了什么?

zy1mlcev

zy1mlcev1#

我解决了这个

issue by configuring pom file with the next dependancy:
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

而不是:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
</dependency>

相关问题