上篇搭建SpringBoot项目时,提到了在application.properties中修改端口号,还有很多常用的配置
1、简单配置
#应用名称spring.application.name=apply#端口号server.port=8888#多环境配置,测试,生产用不同的配置文件spring.profiles.active=test#session超时,单位秒server.session.timeout=30#配置项目访问路径,不配置,就是直接访问Controller中@RequestMapping("/test")的#路径,若配置了这个属性,访问时在原controller路径的基础上加上,上下文路径,这个#配置在nginx分发时有很大用处server.context-path=/ect/apply/baic#HTTP请求最大值server.max-http-header-size=10000000
2、数据库连接配置
spring.datasource.app.url=jdbc:oracle:thin:@//172.20.2.44:1521/testdbspring.datasource.app.username=testspring.datasource.app.password=test123spring.datasource.app.driver-class-name=oracle.jdbc.driver.OracleDriverspring.datasource.app.type=com.alibaba.druid.pool.DruidDataSourcespring.datasource.app.minIdle=5spring.datasource.app.maxActive=400spring.datasource.app.initialSize=10spring.datasource.app.maxWait=60000spring.datasource.app.timeBetweenEvictionRunsMillis=60000spring.datasource.app.minEvictableIdleTimeMillis=300000spring.datasource.app.validationQuery=SELECT 1 FROM DUALspring.datasource.app.testWhileIdle=truespring.datasource.app.testOnBorrow=falsespring.datasource.app.testOnReturn=falsespring.datasource.app.poolPreparedStatements=truespring.datasource.app.maxPoolPreparedStatementPerConnectionSize=50spring.datasource.app.removeAbandoned=truespring.datasource.app.filters=stat
3、redis配置
spring.redis.host=172.30.2.134spring.redis.port=6379spring.redis.timeOut=5000spring.redis.maxIdle=50spring.redis.maxWaitMillis=5000spring.redis.maxActive=300
4、tomcat的几个配置
#tomcat最大线程数server.tomcat.max-threads= 2000#tomcat最大连接数server.tomcat.max-connections= 500#编码方式server.tomcat.uri-encoding=UTF-8#post提交数据最大大小,设置为0不限制server.tomcat.max-http-post-size=0
5、Mybatis
#mybatismybatis.mapperLocations=classpath:mapper/*.xml#mybatis.type-aliases-package=com.mundo.test.pojomybatis.configLocation=classpath:mybatis/mybatis-config.xml
还有很多与其他框架集成的配置,需要不断积累不断学习,每天进步一点点,人生将迈进一大步,你侬我侬不如码农,欢迎关注转发评论!