I have a Spring Boot (2.6.6) application which is connected to the Azure App Configuration. I also use the automated refresh mechanisms from the Azure App Configuration, which works fine - I change a value in Azure App Configuration and also update the sentinel value, then the application detects the changes and update the bean values (properties) by calling the setter methods without restarting the application.
But after I added a class with @EnableGlobalMethodSecurity(prePostEnabled = true), then the refresh mechanisms is not working anymore. Only during startup, the values are set, then never again. I see in the log that the application detects the changes, but never calls the setter of the bean to update the values.
How can I solve this problem to have the automated refresh mechanisms and the PreAuthorize working together?
MethodSecurityConfiguration.class:
@Configuration
@AllArgsConstructor
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class MethodSecurityConfiguration extends GlobalMethodSecurityConfiguration {
...
}
ConfigurationProperties.class:
public interface AppConfigurationProperties {
void setExample(String example);
String getExample();
}
AzureAppConfigurationProperties.class:
@Configuration
@ConfigurationProperties(prefix = "config")
public class AzureAppConfigurationProperties implements AppConfigurationProperties {
private String example;
@Override
public void setExample(String example) {
this.example = example;
}
@Override
public String getExample() {
return this.example;
}
}