Can’t find SecurityMockMvcConfigurers Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Can’t find SecurityMockMvcConfigurers without wasting too much if your time.

The question is published on by Tutorial Guruji team.

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>
We are here to answer your question about Can’t find SecurityMockMvcConfigurers - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji