I created a project in Github to demonstrate this issue. Why isn't org.springframework.security.oauth2.config.annotation.web.configuration in the classpath?
I have an existing Spring Boot 1.5.x project using Spring Security 4.x that I am trying to upgrade to Spring Boot 2.x with Spring Security 5.x using spring-security-oauth2-autoconfigure:
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>
Here is one of the failing imports:
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
Application.java:[9,79] package org.springframework.security.oauth2.config.annotation.web.configuration does not exist [ERROR] /Users/stevemitchell/Downloads/problem-spring-security-oauth2-boot/src/main/java/com/demo/service/auth/Application.java:[16,2] cannot find symbol symbol: class EnableResourceServer
I can see org.springframework.security.oauth:spring-security-oauth2:jar:2.3.3.RELEASE:runtime in "mvn dependency:tree."
$ mvn dependency:tree
...
[INFO] \- org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:jar:2.0.5.RELEASE:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.6:compile
[INFO] +- org.springframework.boot:spring-boot:jar:2.0.5.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.5.RELEASE:compile
[INFO] +- org.springframework.security.oauth:spring-security-oauth2:jar:2.3.3.RELEASE:runtime
[INFO] | +- org.springframework:spring-webmvc:jar:5.0.9.RELEASE:compile
[INFO] | +- commons-codec:commons-codec:jar:1.11:runtime
[INFO] | \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:runtime
[INFO] | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:runtime
[INFO] +- org.springframework.security:spring-security-jwt:jar:1.0.9.RELEASE:compile
[INFO] | \- org.bouncycastle:bcpkix-jdk15on:jar:1.56:compile
[INFO] | \- org.bouncycastle:bcprov-jdk15on:jar:1.56:compile
[INFO] \- org.springframework:spring-web:jar:5.0.9.RELEASE:compile
This should compile. What am I missing?