Error Creating bean with name 'springSecurityFilterChain' defined in class path Resource

Asked

Viewed 430 times

1

org.springframework.Beans.factory.Beancreationexception: Error Creating bean with name 'springSecurityFilterChain' defined in class path Resource [org/springframework/security/config/Annotation/web/Configuration/Websecurityconfiguration.class]: Bean instantiation via Factory method failed; nested Exception is org.springframework.Beaninstantiationexception: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw Exception; nested Exception is java.lang.Nullpointerexception at org.springframework.Beans.factory.support.ConstructorResolver.instantiate(Constructorresolver.java:655) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(Constructorresolver.java:483) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(Abstractautowirecapablenfactory.java:1336) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(Abstractautowirecapablenfactory.java:1176) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(Abstractautowirecapablenfactory.java:556) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(Abstractautowirecapablebeanfactory.java:516) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(Abstractbeanfactory.java:324) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(Defaultsingletonbeanregistry.java:234) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.AbstractBeanFactory.doGetBean(Abstractbeanfactory.java:322) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.AbstractBeanFactory.getBean(Abstractbeanfactory.java:202) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.AbstractBeanFactory.doGetBean(Abstractbeanfactory.java:311) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.AbstractBeanFactory.getBean(Abstractbeanfactory.java:202) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.Beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(Defaultlistablebeanfactory.java:897) ~[spring-Beans-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.context.support.Abstractapplicationcontext.finishBeanFactoryInitialization(Abstractapplicationcontext.java:879) ~[spring-context-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.context.support.Abstractapplicationcontext.refresh(Abstractapplicationcontext.java:551) ~[spring-context-5.2.10.RELEASE. jar:5.2.10.RELEASE] at org.springframework.boot.web.Servlet.context.Servletwebserverapplicationcontext.refresh(Servletwebserverapplicationcontext.java:143) ~[spring-boot-2.3.5.RELEASE. jar:2.3.5.RELEASE] at org.springframework.boot.SpringApplication.refresh(Springapplication.java:758) ~[spring-boot-2.3.5.RELEASE. jar:2.3.5.RELEASE] at org.springframework.boot.SpringApplication.refresh(Springapplication.java:750) ~[spring-boot-2.3.5.RELEASE. jar:2.3.5.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(Springapplication.java:405) ~[spring-boot-2.3.5.RELEASE. jar:2.3.5.RELEASE] at org.springframework.boot.SpringApplication.run(Springapplication.java:315) ~[spring-boot-2.3.5.RELEASE. jar:2.3.5.RELEASE] at org.springframework.boot.SpringApplication.run(Springapplication.java:1237) ~[spring-boot-2.3.5.RELEASE. jar:2.3.5.RELEASE] at org.springframework.boot.SpringApplication.run(Springapplication.java:1226) ~[spring-boot-2.3.5.RELEASE. jar:2.3.5.RELEASE] at br.com.gipisistemas.msgipigatewayzuul.Msgipigatewayzuulapplication.main(Msgipigatewayzuulapplication.java:14) ~[classes/:na]

conducting a survey I found several solutions including the link: https://github.com/spring-guides/tut-spring-boot-oauth2/issues/68

but none worked out anyone can help me?

4.0.0 org.springframework.boot spring-boot-Starter-Parent 2.3.5.RELEASE br.com.gipisistemas ms-gipi-gateway-Zuul 0.0.1-SNAPSHOT ms-gipi-gateway-Zuul Zuul server

<properties>
    <java.version>11</java.version>
    <spring-cloud.version>Hoxton.SR9</spring-cloud.version>
    <swagger.version>2.9.2</swagger.version>
    <jaxb.api.version>2.3.0</jaxb.api.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-oauth2</artifactId>
    </dependency>

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>${swagger.version}</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>${swagger.version}</version>
    </dependency>

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

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>${jaxb.api.version}</version>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>${jaxb.api.version}</version>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>${jaxb.api.version}</version>
    </dependency>


    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

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

1 answer

-1

I was having the same problem John, just add the dependency:

    <dependency>
        <groupId>org.springframework.security.oauth.boot</groupId>
        <artifactId>spring-security-oauth2-autoconfigure</artifactId>
        <version>2.5.0</version>
    </dependency>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.