//方法一,通过配置config来配置实体类
@Configuration
@PropertySource(value="classpath:pay.properties")
public class WXConfig implements Serializable {
@Value("${wxpay.appid}")
private String payAppid;
}
//方法二,通过controller层直接引用
@RestController
@RequestMapping("api/v1/test")
@PropertySource({"classpath:pay.properties"})
public class TestController {
@Value("${wxpay.appid}")
private String payAppid;
}