spring boot之端口设置和contextpath的配置[通俗易懂]

spring boot之端口设置和contextpath的配置[通俗易懂]端口设置Springboot默认端口是8080,如果想要进行更改的话,只需要修改applicatoin.properties文件,在配置文件中加入:1server.port=9090常用配置:1234567891011121314151617

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

端口设置

Spring boot 默认端口是8080,如果想要进行更改的话,只需要修改applicatoin.properties文件,在配置文件中加入:

1
server.port=
9090

常用配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
########################################################
###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 路径。

1
server.context-path=/spring-boot

常用配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
########################################################
###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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/192827.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Ubuntu 10.04 更新源[通俗易懂]

    Ubuntu 10.04 更新源[通俗易懂]1.sudogedit/etc/apt/sources.list编辑你的源列表,将原来的内容全部删除,当然之前也可以用sudocp/etc/apt/sources.list/etc/apt

    2022年7月2日
    26
  • 页式虚拟存储管理_页式虚拟存储管理的主要特点

    页式虚拟存储管理_页式虚拟存储管理的主要特点页式存储的基本原理    将程序的逻辑地址空间划分为固定大小的页(page),而物理内存划分为同样大小的页框(pageframe)。程序加载时,可将任意一页放人内存中任意一个页框,这些页框不必连续,从而实现了离散分配。也就是把内存等分成N份,存放运行的程序时,按分成的快放置即可。但放置时要考虑主存里哪些块已经被占用,这个用主存分配表(位示图)来表示。     分页式存储器的逻辑

    2022年9月26日
    5
  • 64位ubuntu 14.04安装32位dr.com客户端教程(不用安装glibc.i686 libstdc++.i686)

    64位ubuntu 14.04安装32位dr.com客户端教程(不用安装glibc.i686 libstdc++.i686)64位的ubuntu没32位的运行库真是令人bei

    2022年5月12日
    38
  • MYSQLServer2008R2详细的图文安装教程

    MYSQLServer2008R2详细的图文安装教程本文主要总结了在win7系统上安装Mysql_Server2008(64位)的详细图文教程,具体的安装步骤如下所示:MysqlServer2008R2企业版下载地址:(直接打开链接,默认用的是迅雷下载,里面自带序列号)ed2k://|file|cn_sql_server_2008_r2_enterprise_x86_x64_ia64_dvd_522233.iso|4662884352|1D…

    2022年7月27日
    12
  • [转]组合数取模【转自AekdyCoin的组合数取模】

    [转]组合数取模【转自AekdyCoin的组合数取模】转载自大牛的百度空间:http://hi.baidu.com/aekdycoin/item/e051d6616ce60294c5d249d7大家都在中学阶段学习了组合数的定义:这个表示的是从n个元素中选取m个元素的方案数。(PS.组合数求模似乎只用在信息学竞赛和ACM竞赛等计算机编程设计大赛中……,求在现实中的运用)可以知道当n,m取得比较大的时候,组合数可能很大很大(天文数字?无…

    2022年7月23日
    8
  • javascript电子书下载

    javascript电子书下载百度云:https://pan.baidu.com/s/1hCZ0T5jeMlp8bDhW-KQzLQ密码:35wj包括不限于:香帅的北大金融学课王立铭生命科学50讲高爽天文学通识30讲薛兆丰的经济学课施展的世界史纲50讲听书需要加我扣扣978733153…

    2022年5月11日
    62

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号