Package com.playtika.test.keycloak
Class EmbeddedKeycloakBootstrapConfiguration
java.lang.Object
com.playtika.test.keycloak.EmbeddedKeycloakBootstrapConfiguration
@Configuration
@ConditionalOnExpression("${embedded.containers.enabled:true}")
@AutoConfigureAfter(com.playtika.test.common.spring.DockerPresenceBootstrapConfiguration.class)
@EnableConfigurationProperties(KeycloakProperties.class)
@ConditionalOnProperty(name="embedded.keycloak.enabled",
matchIfMissing=true)
public class EmbeddedKeycloakBootstrapConfiguration
extends Object
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionkeycloakContainerFactory
(org.springframework.core.env.ConfigurableEnvironment environment, KeycloakProperties properties, org.springframework.core.io.ResourceLoader resourceLoader)
-
Constructor Details
-
EmbeddedKeycloakBootstrapConfiguration
public EmbeddedKeycloakBootstrapConfiguration()
-
-
Method Details
-
keycloakContainerFactory
@Bean public KeycloakContainerFactory keycloakContainerFactory(org.springframework.core.env.ConfigurableEnvironment environment, KeycloakProperties properties, org.springframework.core.io.ResourceLoader resourceLoader) -
keycloakContainer
@Bean(name="embeddedKeycloak", destroyMethod="stop") public KeycloakContainer keycloakContainer(KeycloakContainerFactory factory) Creates and starts aKeycloakContainer
if propertyembedded.keycloak.enabled
evaluates totrue
. The configuration makes no difference if just vanilla Keycloak is on the classpath or any Spring adapter. The container will always be needed. Also registers a shutdown hook to stop the container on context shutdown.- Parameters:
factory
- TheKeycloakContainerFactory
to use, injected by Spring, must not be null- Returns:
- The created
KeycloakContainer
instance to be registered as bean
-