Error creating bean with name 'serverEndpointExporter' defined in class path

出现这个错的原因是在部署项目的时候,项目中含有websocket的@ServerEndpoint注解的时候,如果项目是springboot项目,去除内置tomcat的时候会把websocket的包也给删除掉,所以需要手动加上.加上这个包,然后再打war包,部署到linux的tomcat下就没问题了.

Error creating bean with name 'serverEndpointExporter' defined in class path_第1张图片

        
       
            org.springframework.boot
            spring-boot-starter-tomcat
            provided
        
        
        
        
            org.apache.tomcat.embed
            tomcat-embed-websocket
            8.5.23
        

如果打包就报错的话,把pom里的test依赖删掉,把测试类也删掉

Error creating bean with name 'serverEndpointExporter' defined in class path_第2张图片

或者在测试类里加个这东西就可以了

Error creating bean with name 'serverEndpointExporter' defined in class path_第3张图片

你可能感兴趣的:(error,springboot)