springboot和yaml文件的一点小坑(server.context-path或server.servlet.context-path不起作用)

springboot2.x以上的版本,在.properties里面配置访问路径server.context-path=/X不起作用,需改为server.servlet.context-path=/*

如果是yaml文件的话,需要注意相对位置,相对位置一样,级别一样

eg.

 

从outline就发会发现yaml文件其实可以看出相对位置一样,级别就一样。