Failed to introspect Class [org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration]

We Are Going To Discuss About Failed to introspect Class [org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration]. So lets Start this Java Article.

Failed to introspect Class [org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration]

  1. Failed to introspect Class [org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration]

    The error is helpful in that it can't find the required class javax.servlet.Filter and a common way to have this class is through this dependency:
    <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>

  2. Failed to introspect Class [org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration]

    The error is helpful in that it can't find the required class javax.servlet.Filter and a common way to have this class is through this dependency:
    <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>

Solution 1

If you have below dependency for spring-boot-starter-tomcat in you POM, remove scope part of it.

Existing:

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

New:

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

Original Author Ajay Kumar Of This Content

Solution 2

The error is helpful in that it can’t find the required class javax.servlet.Filter and a common way to have this class is through this dependency:

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

which ends up pulling in org.apache.tomcat.embed:tomcat-embed-core

We were seeing this locally because when running the Spring Boot application from Intellij we didn’t have the option ‘Include dependencies with “Provided” scope’ in the Run/Debug Configuration ticked.

Original Author Matthew Buckett Of This Content

Solution 3

I think this dependency:

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

Made a conflict with this one:

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>
    <type>jar</type>
</dependency>

Why do you need the last one? I think you don’t need it, because you already has starter for security, so remove it.

Original Author codeformars Of This Content

Solution 4

Try adding this to your pom.xml:

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-config</artifactId>
    <version>4.0.1.RELEASE</version>
</dependency>

It helped me.

Original Author Robert Kareta Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment