I am new to Spring boot, what I am having in my project is a Configuration Class annotated with RefreshScope and the same is used in a Pojo Class and a copy is stored in local variable inside constructer.
Please suggest how to refresh that local variable in Pojo Class
Code is as below
@Configuration
@Getter
@RefreshScope
public class ProjectSetting {
@Value("${security.enabled:true}")
private boolean securityEnabled;
}
public class AssetTaggingEventProcessor
{
private ProjectSetting projectSetting;
AssetTaggingEventProcessor()
{
projectSetting = applicationContext.getBean(ProjectSetting.class);
}
}
Thanks @M.Deinum, It worked as you mentioned in comments, moreover I found detail explanation also on other posts that There will be a new proxy object will be prepared and then it will be replaced with actual object to Pojo will have reference to new object.