读取yml配置信息
@Value("${province}") private String province; @Value("${user.sname}") private String name1; @Value("${user1[1].name}") private String name; @Value("${server.port}") private int port;
server: port: 8099 #counter: china province: beijing # # user: sname: 一一丫丫 age: 18 sex: 1 # #spring: # mvc: # servlet: # load-on-startup: 1 user1: - name: 10086 age: 10989 sex: 99 - name: 香香 age: 83 sex: 33
province===================>beijing
age===================>limin
name===================>香香
port===================>8099