ContextPath must start with ‘/‘ and not end with ‘/‘

ContextPath must start with ‘/’ and not end with ‘/’

Springboot项目运行包如下错误:

Initialization of bean failed; nested exception is
java.lang.IllegalArgumentException: 
ContextPath must start with '/' and not end with '/'

关于这个错误是因为配置项目访问路径错误,应该以 / 开头

解决办法(以项目路径访问名为xxxx举例):

server.servlet.context-path=xxxx

改为

server.servlet.context-path=/xxxx

即可,加上/

OK!问题解决!不会的给我私信!
觉得有帮助的可以关注一波!经常分享编程踩坑经验!

你可能感兴趣的:(Java,spring,boot,tomcat,java,spring)