Keycloak 4.0.0 Beta 2 with Spring Boot 2

for anyone looking at this question in 2019: this worked for me

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
        <relativePath/>
        <!-- lookup parent from repository -->
    </parent>


        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-spring-boot-2-starter</artifactId>
            <version>4.0.0.Final</version>
        </dependency>

If you are using Maven, just add keycloak-spring-boot-2-starter dependency:

<!-- https://mvnrepository.com/artifact/org.keycloak/keycloak-spring-boot-2-starter -->
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-spring-boot-2-starter</artifactId>
    <version>4.0.0.Final</version>
</dependency>

I had the same problem. Just make sure you include the spring boot 2 starter and don't use the adapter directly.

compile 'org.keycloak:keycloak-spring-boot-2-starter:4.0.0.Beta2'