好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

springboot 如何设置端口号和添加项目名

1、修改全局配置文件(application.yml)

?

1

2

3

4

server:

   port: 9001

   servlet:

     context-path: /userRight

【坑】SpringBoot 指定服务项目名

使用不同SpringBoot版本,指定访问项目路径的项目名,使用的配置也不一样

有网友指出

SpringBoot版本 配置
1.x server.context-path=/demo
2.x server.servlet.context-path=/demo

以下为本地测试可行代码

pom.xml中使用SpringBoot版本

?

1

< version >1.5.9.RELEASE</ version >

application.properties文件添加

?

1

server.context-path=/demo

pom.xml中使用SpringBoot版本

?

1

< version >2.0.2.RELEASE</ version >

application.properties文件添加

?

1

server.servlet.context-path=/demo

以上为个人经验,希望能给大家一个参考,也希望大家多多支持。

原文链接:https://blog.csdn.net/weixin_45739720/article/details/103658670

查看更多关于springboot 如何设置端口号和添加项目名的详细内容...

  阅读:22次