Spring碎片知识

SpringBoot

命令行传参

java -jar xxx.jar --a1=aaa --b1=bbb

可以通过@Value("${a1}") 获取

application.properties注入数组

两种方式

  1. 在properties文件中按照数组格式组织
    com.aliyun.mns.queueName.prefix[0]=aa
    com.aliyun.mns.queueName.prefix[1]=bb
    com.aliyun.mns.queueName.prefix[2]=cc
  2. 在@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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值