springboot之端口设置和contextpath的配置方式
作者:吸引力的觉悟 发布时间:2023-10-05 14:16:20
标签:springboot,端口,contextpath
端口设置和contextpath的配置
端口设置
Spring boot 默认端口是8080,如果想要进行更改的话,只需要修改applicatoin.properties文件,在配置文件中加入:
server.port= 9090
常用配置:
########################################################
###EMBEDDED SERVER CONFIGURATION (ServerProperties)
########################################################
#server.port=8080
#server.address= # bind to a specific NIC
#server.session-timeout= # session timeout in seconds
#the context path, defaults to '/'
#server.context-path=/spring-boot
#server.servlet-path= # the servlet path, defaults to '/'
#server.tomcat.access-log-pattern= # log pattern of the access log
#server.tomcat.access-log-enabled=false # is access logging enabled
#server.tomcat.protocol-header=x-forwarded-proto # ssl forward headers
#server.tomcat.remote-ip-header=x-forwarded-for
#server.tomcat.basedir=/tmp # base dir (usually not needed, defaults to tmp)
#server.tomcat.background-processor-delay=30; # in seconds
#server.tomcat.max-threads = 0 # number of threads in protocol handler
#server.tomcat.uri-encoding = UTF-8 # character encoding to use for URL decoding
ContextPath配置
Spring boot默认是/ ,这样直接通过http://ip:port/就可以访问到index页面,如果要修改为http://ip:port/path/ 访问的话,那么需要在Application.properties文件中加入server.context-path = /你的path,比如:spring-boot,那么访问地址就是http://ip:port/spring-boot 路径。
server.context-path=/spring-boot
常用配置:
########################################################
###EMBEDDED SERVER CONFIGURATION (ServerProperties)
########################################################
#server.port=8080
#server.address= # bind to a specific NIC
#server.session-timeout= # session timeout in seconds
#the context path, defaults to '/'
#server.context-path=/spring-boot
#server.servlet-path= # the servlet path, defaults to '/'
#server.tomcat.access-log-pattern= # log pattern of the access log
#server.tomcat.access-log-enabled=false # is access logging enabled
#server.tomcat.protocol-header=x-forwarded-proto # ssl forward headers
#server.tomcat.remote-ip-header=x-forwarded-for
#server.tomcat.basedir=/tmp # base dir (usually not needed, defaults to tmp)
#server.tomcat.background-processor-delay=30; # in seconds
#server.tomcat.max-threads = 0 # number of threads in protocol handler
#server.tomcat.uri-encoding = UTF-8 # character encoding to use for URL decoding
Springboot中添加contextPath
spring boot默认是/ ,这样直接通过http://ip:port/就可以访问到index页面,如果要修改为http://ip:port/path/ 访问的话,那么需要在Application.properties文件中加入server.context-path= /你的path,比如:spring-boot,那么访问地址就是http://ip:port/spring-boot路径。
profile配置
server.context-path=/spring-boot
server
context-apth: /spring-boot
来源:https://blog.csdn.net/u012100371/article/details/76409388
0
投稿
猜你喜欢
- 【漏洞通告】2月19日,NVD发布安全通告披露了jackson-databind由JNDI注入导致的远程代码执行漏洞(CVE-2020-88
- 本文实例为大家分享了Android studio实现PopupWindow弹出框的具体代码,供大家参考,具体内容如下实现步骤:第一步:自定义
- 本文较为深入的分析了android中UI主线程与子线程。分享给大家供大家参考。具体如下:在一个Android 程序开始运行的时候,会单独启动
- 上篇文章给大家介绍了,喜欢的朋友点击查看下。SpringBoot 开发提速神器 Lombok+MybatisPlus+SwaggerUILo
- 集成配置步骤步骤1:加入 Maven 相关依赖<!-- 指定 Springboot 版本 --><parent> &
- C# 反射(Reflection)反射指程序可以访问、检测和修改它本身状态或行为的一种能力。程序集包含模块,而模块包含类型,类型又包含成员。
- 为什么要使用克隆? 想对一个对象进行处理,又想保留原有的数据进行接下来的操作,就需要克隆了,Java语言中克隆针对的是类的实例。如何实现对象
- Android 3.0引入了CursorLoader实现异步加载数据,为了避免同步查询数据库时阻塞UI线程的问题。在API 11之前可以通过
- 上一篇《Android 自定义View(一) Paint、Rect、Canvas介绍》讲了最基础的如何自定义一个View,以及View用到的
- 本文讲述了在Java中如何创建和结束线程的最基本方法,只针对于Java初学者。一些高级知识如线程同步、调度、线程池等内容将会在后续章节中逐步
- 绑定多个按钮到同一个事件1.添加代码private void clauseElementClicked(object sender, Eve
- 安卓项目开发中,项目中使用到jni开发,使用C/C++编写了自己的so库,调试和运行一切正常,Android.mk文件代码如下:LOCAL_
- 博主说:有时候,我们需要对数据库中现有的数据进行大量处理操作(例如表中的某个字段需要全部更新等),如果直接使用select * from t
- 1.申请微信公众号我们要进行微信公众平台的开发,第一步当然是要有公众号了。什么?不知道什么是微信公众号,看来你还要先回炉炼炼了,呵呵。通俗的
- 一.简单介绍1.配置相关的依赖2.配置模式3写.mapper、controller、service4.配置yaml文件 配置mybatis全
- ${} 和 #{} 都是 MyBatis 中用来替换参数的,它们都可以将用户传递过来的参数,替换到 MyBatis 最终生成的 SQL 中,
- 英文意思随机数可以做什么?生成一些随机的数字用途非常的广泛, 例如随机抽取数据库的一条记录,把生成的数字给变量,某一个时间点执行一些代码,随
- 1.一段简单的代码首先来一段代码,这个是单例模式,可能有的人不知道什么是单例模式,我就简单说一下单例模式是指一个类有且只有一种对象实例。这里
- 本文为大家分享了android studio3.4安装指南,供大家参考,具体内容如下1、双击运行Android Studio安装包,点击ne
- 前言之前做移动端开发,都不清楚WebService是啥东东,现在接触c#,项目中有三处WebService调用,就不得不与其打交道了,最近碰