-1

Following is my class:-

enter image description here

As you can see there are three red lines coming due to some unknown reason. It is coming when I am trying to extend WebSecurityConfigureAdapter class. The errors are as following respectively:-

Error 1:

enter image description here

Error 2:

enter image description here

Error 3:

enter image description here

I trying to integrate Spring Security with a Spring-Boot application. Here is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>SpringBoot</groupId>
    <artifactId>SpringWebAngularJS</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>SpringWebAngularJS</name>
    <description>Spring Boot Web AngularJs Example</description>

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

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

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-couchbase</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>

        <dependency>
            <groupId>com.github.ulisesbocchio</groupId>
            <artifactId>jasypt-spring-boot-starter</artifactId>
            <version>1.10</version>
        </dependency>

        <!-- <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.7</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>3.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>angularjs</artifactId>
            <version>1.6.4</version>
        </dependency> -->
        
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

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

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

What is going wrong?

Eclipse STS version : spring-tool-suite-3.8.4.RELEASE-e4.6.3-win32-x86_64

Community
  • 1
  • 1

3 Answers3

1

After looking at the project that got attached to the issue at GitHub, it turned out to be a problem with the JAR files in the local Maven cache.

There I would recommend to delete the local Maven cache (~/.m2/repository) and do an "Maven -> Update Project" afterwards, maybe selecting the "force download of snapshots and releases" checkbox.

Martin Lippert
  • 5,988
  • 1
  • 15
  • 18
1

I encountered the same issue. If you are using spring boot starter make sure you are using spring boot starter security. If your are using other versions of the dependency it doesn't work.

0

This looks very much like an inconsistency in your classpath (or dependency) setup. I am not sure what exactly is causing this inconsistency, but you should check your dependency hierarchy, maybe different versions of the same library are being used at the same time. Maybe jasypt-spring-boot-starter in version 1.10 is using different dependencies than Boot 1.5.4 and is therefore not yet compatible? Just guessing here...

Martin Lippert
  • 5,988
  • 1
  • 15
  • 18
  • I removed the `jasypt` from pom.xml and revert the encrypted password to plain text but still, I am getting the same error. Additionally, I downloaded the new version of IDE i.e. **spring-tool-suite-3.9.0.RELEASE-e4.7.0-win32-x86_64** to check but getting the same error. – Satyaprakash Nayak Sep 04 '17 at 12:49
  • To further identify the issue, you could try to create a simple Spring Boot project using the `Spring Starter Project` wizard in STS. Does that work? If that works and your project doesn't, you could also try to file an issue and attach your project via GitHub, so that we could take a deeper look. – Martin Lippert Sep 05 '17 at 13:47
  • Okay, let me try this. – Satyaprakash Nayak Sep 05 '17 at 13:52
  • I build a new project from the scratch and add same classes but did not find any change. I am getting the same error with no clue what is wrong. – Satyaprakash Nayak Sep 06 '17 at 06:00
  • Basically, I am trying to use SpringBoot Actuator metrics in a secure way, for that, I need to use Spring Security. Is there any other way around to implement metrics in a secure way? – Satyaprakash Nayak Sep 06 '17 at 06:09
  • I have no clue what exactly goes wrong with the projects that you use. Can you upload the project(s) for us to give it a try, maybe to see what is going wrong? – Martin Lippert Sep 07 '17 at 11:11
  • Yeah, sure but I don't know much about git thing. Can you please assist? – Satyaprakash Nayak Sep 08 '17 at 12:16
  • create an issue on GitHub (https://github.com/spring-projects/spring-ide/issues), create a zip of your project, and attach it to that issue somehow. Or upload your project somewhere else (whatever you prefer) and link to it from the issue. – Martin Lippert Sep 09 '17 at 14:36
  • Martin Lippert thanks. As you recommended `to delete the local Maven cache (~/.m2/repository) and do an "Maven -> Update Project" afterwards, maybe selecting the "force download of snapshots and releases" checkbox` it started working fine. If you answer the same I will definitely mark it as answered. – Satyaprakash Nayak Sep 12 '17 at 06:30