小编anu*_*hav的帖子

如何在Springboot 2.1.1 Final中配置CXF servlet?

请找到我面临的错误:在 springboot 2.1.1 中,我遇到以下错误:


应用程序无法启动


描述:org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration 中构造函数的参数 1 需要类型为“org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath”的 bean,但无法找到。找到了以下候选,但无法注入: - 'DispatcherServletAutoConfiguration.DispatcherServletRegistrationConfiguration' 中的 Bean 方法 'dispatcherServletRegistration' 未加载,因为 DispatcherServlet Registration 发现非调度程序 Servlet DispatcherServlet

行动:

考虑重新访问上面的条目或在配置中定义“org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath”类型的 bean。

我的配置:

@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;
    }

}
Run Code Online (Sandbox Code Playgroud)

请确认如何配置?

dispatcherServlet()方法不适用于Springboot 2.1.1

apache soap cxf

2
推荐指数
1
解决办法
2711
查看次数

标签 统计

apache ×1

cxf ×1

soap ×1