spring - ServletRegistrationBean 不适用于多个 URL 映射路径
问题描述
我正在开发查看https://howtodoinjava.com/spring-boot/spring-boot-soap-webservice-example/的代码,在下面的 bean 中我想允许对 and 执行请求/*
,/service/*
所以我改为
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext){
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/service/*");
}
到
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext){
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/*","/service/*");
}
/service/*
当我们执行url时,下面的配置不起作用。我们如何解决这个问题?