@Component @ConfigurationProperties(prefix = "xxx.config") public class IotSaasConfiguration { private String haha; private String xixi; }
创建实体类加入以上2个注解,可以获取到配置文件对应的值赋值入实体类中
在需要使用的service中直接注入即可,会自动赋值
欢迎分享,转载请注明来源:内存溢出
@Component @ConfigurationProperties(prefix = "xxx.config") public class IotSaasConfiguration { private String haha; private String xixi; }
创建实体类加入以上2个注解,可以获取到配置文件对应的值赋值入实体类中
在需要使用的service中直接注入即可,会自动赋值
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)