Can’t find SecurityMockMvcConfigurers

I’am trying to write a spring security test as described here http://docs.spring.io/spring-security/site/docs/4.0.x/reference/htmlsingle/#test-mockmvc-setup. I need to import SecurityMockMvcConfigurers as a static import, but my IDE does not find the class.

My pom.xml looks as follows:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.0.M2</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-security</artifactId>
    </dependency>

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

Spring Boot 1.4.0.M2 imports Spring Security 4.0.4.RELEASE. I’ can’t find the class in this release. Which additional dependency do I need? Or what else I haven’t considered?

Answer

The missing dependency was:

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-test</artifactId>
    <version>4.0.4.RELEASE</version>
</dependency>

Leave a Reply

Your email address will not be published. Required fields are marked *