请找出我面临的错误: 在 springboot 2.1.1 中,我遇到以下错误:
APPLICATION FAILED TO START
Description: Parameter 1 of constructor in org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration required a bean of type 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath' that could not be found. The following candidates were found but could not be injected: - Bean method 'dispatcherServletRegistration' in 'DispatcherServletAutoConfiguration.DispatcherServletRegistrationConfiguration' not loaded because DispatcherServlet Registration found non dispatcher servlet dispatcherServlet
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath' in your configuration.
我的配置:
@Configuration
public class CXFConfig {
@Bean
public ServletRegistrationBean dispatcherServlet() {
final ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new CXFCdiServlet(), "/services/*");
servletRegistrationBean.setLoadOnStartup(1);
return servletRegistrationBean;
}
@Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
SpringBus springBus = new SpringBus();
springBus.getInInterceptors().add(new AppInboundInterceptor());
springBus.getOutInterceptors().add(new AppOutboundInterceptor());
return springBus;
}
}
请确认如何进行配置?
dispatcherServlet()
方法在 Springboot 2.1.1
中不起作用
最佳答案
我通过将方法名称从 dispatcherServlet 更改为 disServlet 解决了这个问题。 也许你可以试试。
关于apache - 如何在 Springboot 2.1.1 Final 中配置 CXF servlet?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53987157/