找到了解决方案。我在引导类的注释中添加了以下排除
@SpringBootApplication(exclude = DispatcherServletAutoConfiguration.class)
并按以下方式更改了WebServicesConfiguration类:
@Configuration
public class WebServicesConfiguration extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean mvcDispatcherServlet(ApplicationContext context) {
DispatcherServlet servlet = new DispatcherServlet();
servlet.setApplicationContext(context);
return new ServletRegistrationBean(servlet, "/dummy");
}
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext context) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(context);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/");
}
}