Mick Knutson
Mick Knutson

Reputation: 2427

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)

Upvotes: 3

Views: 1169

Answers (1)

Pratik Shah
Pratik Shah

Reputation: 1852

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)
        . //...
}

Upvotes: 5

Related Questions