springboot中application.properties配置

#application.properties常用配置
server.port=8086
# bind to a specific NIC
server.address=0.0.0.0
#server.address=127.0.0.1
# the context path, defaults to ‘/‘
#设置以后请求映射变为 http:ip:port/demo/....对应controller中的映射路径
server.context-path=/demo
# the servlet path, defaults to ‘/‘
server.servlet-path=/
# base dir (usually not needed, defaults to tmp)
server.tomcat.basedir=/tmp
# in seconds
server.tomcat.background-processor-delay=30
# number of threads in protocol handler
server.tomcat.max-threads = 0
# character encoding to use for URL decoding
server.tomcat.uri-encoding = UTF-8

#数据库配置
spring.datasource.url = jdbc:mysql://127.0.0.1:3306/demo?autoReconnect=true&characterEncoding=utf8&useSSL=false
spring.datasource.username =root
spring.datasource.password =123456
spring.datasource.driverClassName =com.mysql.jdbc.Driver
# Specify the DBMS
spring.jpa.database = MYSQL
# Show or not log for each sql query
spring.jpa.show-sql = false
# Hibernate ddl auto (eg. validate | update | create | create-drop)
spring.jpa.hibernate.ddl-auto = none
# Naming strategy
#spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.DefaultNamingStrategy
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
# stripped before adding them to the entity manager)
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

# MONGODB (MongoProperties)
#spring.data.mongodb.authentication-database= # Authentication database name.
spring.data.mongodb.database=crawler
#spring.data.mongodb.field-naming-strategy= # Fully qualified name of the FieldNamingStrategy to use.
#spring.data.mongodb.grid-fs-database= # GridFS database name.
spring.data.mongodb.host=114.215.97.109
#spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
# Enable Mongo repositories.
spring.data.mongodb.repositories.enabled=true
#spring.data.mongodb.uri=mongodb://localhost/test # Mongo database URI. When set, host and port are ignored.
spring.data.mongodb.username=crawler_demo
spring.data.mongodb.password=0305Wmph


#Redis配置
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.database=1
spring.redis.password=mypassword


#数据库设置
# 下面为连接池的补充设置,应用到上面所有数据源中
# 初始化大小,最小,最大
spring.datasource.initialSize=5
spring.datasource.minIdle=1
spring.datasource.maxActive=50
# 配置获取连接等待超时的时间
spring.datasource.maxWait=60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
spring.datasource.timeBetweenEvictionRunsMillis=60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
spring.datasource.minEvictableIdleTimeMillis=300000
spring.datasource.validationQuery=SELECT 1 FROM DUAL
spring.datasource.testWhileIdle=true
spring.datasource.testOnBorrow=false
spring.datasource.testOnReturn=false
# 打开PSCache,并且指定每个连接上PSCache的大小
spring.datasource.poolPreparedStatements=false
#spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,‘wall‘用于防火墙
spring.datasource.filters=stat,wall,log4j
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 合并多个DruidDataSource的监控数据
#spring.datasource.useGlobalDataSourceStat=true

 

springboot中application.properties配置

上一篇:Boss直聘App上“天使投资、VC、PE” 与“A轮、B轮、C轮融资”的关系


下一篇:Android 内存泄漏