KEYCLOAK-8857 Update the Using Spring Boot Configuration
section (#1347)
* update bean declaration example to explicitly show that it should be declared in a class separate to `KeycloakWebSecurityConfigurerAdapter` * add explanation to possible `Circular References` problem in Spring Boot 2.6+ * remove unnecessary whitespace Co-authored-by: Stian Thorgersen <stianst@gmail.com>
This commit is contained in:
parent
fa2daf53a4
commit
0237a4766d
1 changed files with 10 additions and 4 deletions
|
@ -279,18 +279,24 @@ If you are using the Keycloak Spring Boot Starter to make use of the Spring Secu
|
|||
|
||||
====== Using Spring Boot Configuration
|
||||
|
||||
By Default, the Spring Security Adapter looks for a `keycloak.json` configuration file. You can make sure it looks at the configuration provided by the Spring Boot Adapter by adding this bean :
|
||||
By Default, the Spring Security Adapter looks for a `keycloak.json` configuration file. You can make sure it looks at the configuration provided by the Spring Boot Adapter by adding this bean:
|
||||
|
||||
[source,java]
|
||||
----
|
||||
|
||||
@Bean
|
||||
public KeycloakConfigResolver keycloakConfigResolver() {
|
||||
return new KeycloakSpringBootConfigResolver();
|
||||
@Configuration
|
||||
public class CustomKeycloakConfig {
|
||||
|
||||
@Bean
|
||||
public KeycloakConfigResolver keycloakConfigResolver() {
|
||||
return new KeycloakSpringBootConfigResolver();
|
||||
}
|
||||
}
|
||||
|
||||
----
|
||||
|
||||
Do not declare the `KeycloakConfigResolver` bean in a configuration class that extends `KeycloakWebSecurityConfigurerAdapter` as this will cause a `Circular References` problem in Spring Boot starting with version 2.6.0.
|
||||
|
||||
====== Avoid double bean registration
|
||||
|
||||
Spring Boot attempts to eagerly register filter beans with the web application context.
|
||||
|
|
Loading…
Reference in a new issue