Spring Boot 2.0 常见问题总结(二)
使用 IDEA 生成 POJO 实体类 a. 使用 idea 连接上需要操作的数据库。 b. 选中要生成实体类的数据库表:右键 ---> Scripted Extensions ---> Generate POJOs.groovy。 c. 在弹出的窗口选择生成的位置即可。 application.properties 属性自动映射实体类配置 a. 在 application.properties 文件中定义的属性如下 wxpay.appid=wx5beac15ca207cdd40c wxpay.appsecret=5548012f33417fdsdsdd6f96b382fe548215e9 b.使用 @PropertySource(value = "classpath:application.properties") 即可。 @Getter @Setter @Configuration @PropertySource(value = "classpath:application.properties") public class WeChatConfig { @Value("${wxpay.appid}") private String appId; // 公众号 appid @Value("${wxpay.appsecret}") private String appsecret