1、resources/datasources
注意:配置文件application.yml中使用的是resources/datasources
静态资源文件配置:
这个配置还是错误的,因为static-locations前面的缩进不对,一般缩进两空格
spring:
resources:
static-locations: file:/F:/srfa/temp/
正确静态资源文件配置:
spring:
resources:
static-locations: file:/F:/srfa/temp/
多数据源配置
spring:
datasources:
ds1:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://172.16.11.66:3306/sitemanage?useUnicode=true&characterEncoding=UTF-8
username: root
password: jsptpd
driver-class-name: com.mysql.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
#自动检测关闭和空闲连接的间隔
timeBetweenEvictionRunsMillis: 30000
#最小生存时间
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
#这个参数设置为true,可以保证每次的连接都是正常的,但是。。 性能会降低, 建议使用空闲下检测30s一次, 这样服务器最多30s出现问题后恢复
testOnBorrow: false
testOnReturn: false
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=3000
filters: stat
#PSCatch
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
ds2:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://172.16.11.66:3306/cicdi2?useUnicode=true&characterEncoding=UTF-8
username: root
password: jsptpd
driver-class-name: com.mysql.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
#自动检测关闭和空闲连接的间隔
timeBetweenEvictionRunsMillis: 30000
#最小生存时间
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
#这个参数设置为true,可以保证每次的连接都是正常的,但是。。 性能会降低, 建议使用空闲下检测30s一次, 这样服务器最多30s出现问题后恢复
testOnBorrow: false
testOnReturn: false
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=3000
filters: stat
#PSCatch
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
2、是否开启压缩
如果前端的包放在后台项目的静态资源路径中(浏览器中输入http://172.16.0.47:10002/index.html/
即可访问),如果在手机里显示的话应该对前段的静态资源文件进行压缩,有利于快速访问。
port: 10003 #端口号
compression:
enabled: true #是否开启压缩,默认为false.
spring:
resources:
static-locations: file:/F:/Files/invoice```
网友评论