Spring Boot基础配置
2023/6/19小于 1 分钟
Spring Boot基础配置
查找Spring Boot的配置项
Spring Boot支持配置静态文件代理,但需注意不同版本的配置项存在差异。需根据使用的版本查看具体配置项。
最新版本配置项文档地址
历史版本文档访问地址
spring中文文档
静态文件目录代理
在文档中搜索static-locations配置项,该配置项为需要静态代理的目录。配置如下
spring-boot2.3.7版本的配置参数:
spring:
resources:
static-locations: classpath:/META-INF/resources/, file:D:/test/, classpath:/resources/, classpath:/static/, classpath:/public/ classpath:templates/基础配置参考
server:
# 端口号
port: 8000
servlet:
# 接口统一前缀
context-path: "/"
spring:
datasource:
url: "jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai"
username: "root"
password: "root"
resources:
static-locations: classpath:/META-INF/resources/, file:D:/test/, classpath:/resources/, classpath:/static/, classpath:/public/ classpath:templates/
data:
redis:
host: localhost
port: 6379
password:
database: 0Spring Boot JAR包启动
ps -ef|grep java
kill -9 进程ID
nohup java -Xms512m -Xmx512m -jar /web/aurora-springboot-0.0.1.jar > /web/server.log 2>&1 &