SpringApplicationConfiguration not found: Erroneous spring-boot-starter-test content?

Simeon Leyzerzon picture Simeon Leyzerzon · Feb 22, 2017 · Viewed 37.4k times · Source

Getting a compilation error in Maven:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /C:/prototypes/demo-sse-spring-boot-master/src/test/java/com/cedric/demo/sse/SseDemoApplicationTests.java:[6,37] package org.springframework.boot.test does not exist
[ERROR] /C:/TITAN/demo-sse-spring-boot-master/src/test/java/com/cedric/demo/sse/SseDemoApplicationTests.java:[10,2] cannot find symbol
  symbol: class SpringApplicationConfiguration
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Maven repo seems to have the jar present:

enter image description here

howerever that jar doesn't have any compiled classes inside it. only META-INF dir:

enter image description here

Is that by design? Where do I get the jar containing SpringApplicationConfiguration class to make Maven happy?

Here's the relevant parts of my pom.xml:

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

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>

        <dependency>
            <groupId>org.webjars.bower</groupId>
            <artifactId>jquery</artifactId>
            <version>2.1.3</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.1</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.4</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

Answer

Mohamed picture Mohamed · Mar 14, 2017

In your release the @SpringApplicationConfiguration annotation no longer exists. The new annotations are :

@RunWith(SpringRunner.class)

@SpringBootTest(classes = YourApplicationMainClass.class)

@WebAppConfiguration