该方法可获取配置文件 application.yml,和application.properties文件
配置文件:
参数命名 不能加_ , 不能使用驼峰表示法
server:
port: 9005
payment:
url: https://apipcs3.dccnet.com.cn
port: /api/mybank/pay/cpay/cppayapply/V2
获取参数:
在类中使用标签:@ConfigurationProperties(prefix = “payment”)并将此类交给Spring管理 增加相应的get&set方法
import org.springframework.boot.context.properties.ConfigurationProperties;