@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中直接注入即可,会自动赋值