SpringBoot
命令行传参
java -jar xxx.jar --a1=aaa --b1=bbb
可以通过@Value("${a1}")
获取
application.properties注入数组
两种方式
- 在properties文件中按照数组格式组织
com.aliyun.mns.queueName.prefix[0]=aa
com.aliyun.mns.queueName.prefix[1]=bb
com.aliyun.mns.queueName.prefix[2]=cc - 在@Value中使用分隔符
@Value("#{’${com.aliyun.mns.queueName.prefix}’.split(’,’)}")
加入spring-boot后导致maven的profile多环境配置失效的问题解决
加入spring-boot后导致maven的profile多环境配置失效的问题解决
application.propertise
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
Controller返回html静态文件
SrpingMVC
Get请求传递数组参数
使用@RequestParam注解
- 前端访问:
Get job/list?status=start&status=finish
- 后端接收:
List<Job> selectJobBy(@RequestParam(value="status") List<String> statusList)
spring会帮助将status数组参数全部注入到statusList
中