Spring boot 扩展Web安全配置适配器无法解析

Spring boot 扩展Web安全配置适配器无法解析,spring-boot,Spring Boot,我正在使用SpringBoot,我需要使用extends WebSecurity配置适配器来使用“CORS” 但当我输入“extensedwebsecurityconfigureradapter”时,我有一个错误 Description Resource Path Location Type The type org.springframework.security.authentication.AuthenticationManager cannot be resolved.

我正在使用SpringBoot,我需要使用extends WebSecurity配置适配器来使用“CORS”

但当我输入“extensedwebsecurityconfigureradapter”时,我有一个错误

Description Resource    Path    Location    Type
The type org.springframework.security.authentication.AuthenticationManager cannot be resolved. It is indirectly referenced from required .class files   ServiciosConfig.java    /tutorial/src/main/java/com/service/configure   line 1  Java Problem
我更新了pom.xml:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>
错误开始于
包com.service.configure
p
中,当我删除扩展时,
package
不会出错。。。但是我不能使用
websecurityConfigureAdapter
obvius

编辑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>com</groupId>
    <artifactId>tutorial</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>tutorial</name>
    <description>Project tutorial</description>

        <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.14.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>

       <!-- Spring Boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
      <!-- JPA Data -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

           <!-- MySQL Connector-J -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

          <!-- Data REST -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        </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>

    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>


</project>

4.0.0
通用域名格式
辅导的
0.0.1-快照
战争
辅导的
项目教程
org.springframework.boot
spring启动程序父级
1.5.14.1发布
UTF-8
UTF-8
1.8
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
spring引导启动器数据jpa
mysql
mysql连接器java
运行时
org.springframework.boot
弹簧启动机tomcat
假如
org.springframework.boot
弹簧靴开发工具
真的
org.springframework.boot
弹簧启动启动器数据rest
org.springframework.boot
弹簧靴启动器jdbc
org.springframework.boot
弹簧起动试验
测试
org.springframework.boot
弹簧启动安全
org.springframework.boot
springbootmaven插件
春季快照
春季快照
https://repo.spring.io/snapshot
真的
春季里程碑
春季里程碑
https://repo.spring.io/milestone
假的
春季快照
春季快照
https://repo.spring.io/snapshot
真的
春季里程碑
春季里程碑
https://repo.spring.io/milestone
假的

我终于找到了解决方案

添加pom.xml

 <dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>
    <version>5.0.0.RELEASE</version>
 </dependency>

org.springframework.security

我终于找到了解决办法

添加pom.xml

 <dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>
    <version>5.0.0.RELEASE</version>
 </dependency>

org.springframework.security

更改依赖项以使用此

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

org.springframework.security
spring安全配置

这将解决问题

更改依赖项以使用此

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

org.springframework.security
spring安全配置
这将解决问题

我也有同样的问题。 我删除了.m2文件夹中的repo,并使用以下命令在cmd中重建应用程序: mvn清洁安装-U 这对我很有效。

我也有同样的问题。 我删除了.m2文件夹中的repo,并使用以下命令在cmd中重建应用程序: mvn清洁安装-U
它对我有用。

我试过你的代码,它对我有用。请发布pom.xmlfile@Ganesh帕蒂尔,我用pom.xml更新了我也试过你的pom.xml,它对我有效如果我真的点击包(lamp)帮助是“配置构建路径”我试过你的代码它对我有效请发布pom.xmlfile@Ganesh帕蒂尔,我用pom.xml更新了我也用你的pom.xml进行了尝试,它对我有效如果我点击包(lamp),帮助是“配置构建路径”