加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

SpringBoot整合CXF时,启动报错

发布时间:2020-12-15 07:14:16 所属栏目:Java 来源:网络整理
导读:错误信息: *************************** APPLICATION FAILED TO START *************************** Description:Parameter 1 of constructor in org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration required a bean of t

错误信息:

***************************
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 in your configuration.

通过搜索,说是和SpringBoot版本冲突导致的。

我的SpringBoot版本为2.2.6.RELEASE

整合的Apache CXF版本为3.2.4

我的CXF配置类代码有一段这样的:

@Bean
    public ServletRegistrationBean dispatcherServlet() {
        return new ServletRegistrationBean(new CXFServlet(),"/cxf/*");// 发布服务名称 localhost:8080/cxf
    }

我将其去除并在application.yml配置这行代码:

cxf:
  path: /cxf

最终项目启动起来了,问题得到解决。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读