Spring boot
常用配置
1.程序基本配置
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
2.修改 java 编译版本
Spring Boot
在编译的时候,是有默认
JDK
版本的,如果我们期望使用我们要的
JDK
版本的话,那么要怎么配置
呢?
这个只需要修改 pom.xml 文件的<build> -- <plugins>加入一个 plugin 即可。
<
plugin
>
<
artifactId
>
maven-compiler-plugin
</
artifactId
>
<
configuration
>
<
source
>
1.8
</
source
>
<
target
>
1.8
</
target
>
</
configuration
>
</
plugin
>
添加了 plugin 之后,需要右键 Maven à Update Projects,这时候你可以看到工程根目录下的 JRE System Library
版本更改了。