My spring boot application has security enabled.
How to access /actuator/health
without authentication?
There is a WebSecurityConfigurerAdapter
in the application.
I found an example using:
public void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/health").permitAll().anyRequest().authenticated();
}
and another example using:
public void configure(WebSecurity web) throws Exception {
web.ignoring()
.antMatchers("/actuator/health");
}
What are the advantages and disadvantages of each approach? It will be used for health checking.