server:
port: 8080
servlet:
#项目访问名称
context-path: /springboot
spring:
mvc:
#静态资源映射
static-path-pattern: classpath:/statics/**
resources:
static-locations: /statics/
datasource:
url: jdbc:mysql://localhost:3306/appinfodb?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false
username: root
password: root
driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
#初始化大小
initial-size: 5
#最小值
min-idle: 5
#最大值
max-active: 20
#最大等待时间,配置获取连接等待超时,单位是毫秒
max-wait: 60000
#配置间隔多久进行一次检测,检测需要关闭的空闲连接
time-between-eviction-runs-millis: 60000
#配置一个连接在连接池中最小的生存时间
min-evictable-idle-time-millis: 300000
validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
#配置监控统计拦截的filters,去掉后监控界面的sql就无法统计了
filters: stat,wall,log4j2
use-global-data-source-stat: true
connect-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
jpa:
hibernate:
ddl-auto: update
show-sql: true
thymeleaf:
servlet:
content-type: text/html
cache: false
encoding: UTF-8
mode: LEGACYHTML5
prefix: classpath:/templates/
suffix: .html
check-template-location: true
redis:
#Redis 数据库索引 默认0
database: 0
host: localhost
port: 6379
#password:
jedis:
pool:
max-active: 100
max-wait: 3000
#连接池中最多空闲连接
max-idle: 100
timeout: 1000
devtools:
restart:
enabled: true # 设置开启热部署
additional-paths: src/main/java #重启的目录
exclude: templates/**
freemarker:
cache: false # 页面不加载缓存 ,修改立即生效
servlet:
multipart:
max-request-size: 20MB # 设置上传文件总最大值
max-file-size: 20MB # 单个文件最大值
logging:
level:
com.xl.mapper: debug
mybatis:
type-aliases-package: com.xk.pojo
mapper-locations: classpath:mapper/*.xml
configuration: #显示SQL语句在控制台
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
controller.java
@RequestMapping(value="addAppinfoVersion",method=RequestMethod.POST)
public String addAppinfoVersion(@RequestParam("file")MultipartFile file,
@ModelAtttribute("appVersion")AppVersion
appVersion,Model model){
if(file.isEmptu(){
model.addAttribute("error","上传失败,请选择文件");
return "developer/appversionadd";
})
String fileName=file.getOriginalFilename();
String filePath="D:\\...\\uploadfiles\\";
File dest =new File(filePath+fileName);
try{
file.transferTo(dest);
}catch(IOException e){
e.printStackTrace();
}
}