SpringBoot常⽤配置yml模板与启动类
yml在博客园插⼊代码时选择python才能正常匹配使⽤啊。
注意,#在yml中是注释的意思。
# Tomcat
server:
tomcat:
uri-encoding: UTF-8
max-threads: 1000
min-spare-threads: 30
port: 8080
servlet:
context-path: /city
spring:
jmx:
default-domain: city
devtools:
restart:
enabled: true
profiles:
active: dev
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
enabled: true
freemarker:
suffix: .html
request-context-attribute: request
datasource:
type: com.alibaba.druid.pool.DruidDataSource
platform: oracle
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@127.0.0.1:8080:orcl
username: city
password: city
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
filters: stat,wall,log4j
logSlowSql: true
#mybatis
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
#实体扫描,多个package⽤逗号或者分号分隔
typeAliasesPackage: com.wanli.*.entity
global-config:
#主键类型  0:"数据库ID⾃增", 1:"⽤户输⼊ID",2:"全局唯⼀ID (数字类型唯⼀ID)", 3:"全局唯⼀ID UUID";
#id-type: 0
#字段策略 0:"忽略判断",1:"⾮ NULL 判断"),2:"⾮空判断"
field-strategy: 2
#刷新mapper 调试神器
refresh-mapper: true
#数据库⼤写下划线转换
capital-mode: true
# Sequence序列接⼝实现类配置
#key-generator: batisplus.incrementer.OracleKeyGenerator
#逻辑删除配置
logic-delete-value: -1
springboot切换log4j2logic-not-delete-value: 0
#⾃定义填充策略接⼝实现
#meta-object-handler: com.
db-config:
db-type: oracle
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: null
logging:
level:
ity.dao : debug
启动类:
batis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication
@ServletComponentScan
@MapperScan("batisplus.samples.quickstart.mapper")
public class CityApplication  extends SpringBootServletInitializer{
public static void main(String[] args) {
SpringApplication.run(CityApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(CityApplication.class);
}
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。