Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting debug to true in yaml instead of @EnableWebSecurity(debug = true)

I am NOT using Spring Boot, but I want to be able to turn on/off debugging with YAML such as:

debug: true

Instead of:

@EnableWebSecurity(debug = true)
like image 634
Mick Knutson Avatar asked Jan 31 '26 12:01

Mick Knutson


1 Answers

You can do it using the WebSecurityConfigurerAdapter and WebSecurity#debug.

@Value("${isDebugEnable}")
private Boolean isDebugEnable;

public void configure(WebSecurity web) throws Exception {
    web
        .debug(isDebugEnable)
        . //...
}
like image 159
Pratik Shah Avatar answered Feb 02 '26 00:02

Pratik Shah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!