• SpringBoot整合CXF时,启动报错


    错误信息:

    ***************************
    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.

    通过搜索,说是和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

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

  • 相关阅读:
    Jedis scan及其count的值
    redis中KEYS、SMEMBERS、SCAN 、SSCAN 的区别
    Windows环境下RabbitMQ的启动和停止命令
    HTTP状态码->HTTP Status Code
    给所有的input trim去空格
    git clone 使用用户名和密码
    ABA问题
    FIFO、LRU、LFU的含义和原理
    【phpstorm】破解安装
    【windows7】解决IIS 80端口占用问题(亲测)
  • 原文地址:https://www.cnblogs.com/youcong/p/13875010.html
Copyright © 2020-2023  润新知