软件编程
位置:首页>> 软件编程>> java编程>> springboot 如何设置端口号和添加项目名

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

作者:知识追求者  发布时间:2022-01-11 07:31:12 

标签:springboot,端口号,项目名

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


server:
 port: 9001
 servlet:
   context-path: /userRight

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

【坑】SpringBoot 指定服务项目名

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

有网友指出

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

以下为本地测试可行代码

pom.xml中使用SpringBoot版本


<version>1.5.9.RELEASE</version>

application.properties文件添加


server.context-path=/demo

pom.xml中使用SpringBoot版本


<version>2.0.2.RELEASE</version>

application.properties文件添加


server.servlet.context-path=/demo

来源:https://blog.csdn.net/weixin_45739720/article/details/103658670

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com