Spring boot 如何在新的Spring Boot项目中关闭Spring安全性?
我使用SpringInitializer(at)构建了一个新的SpringBoot项目 我包括了很多东西,包括SpringSecurity,因为我以后会想要它 我有一个带有Spring boot 如何在新的Spring Boot项目中关闭Spring安全性?,spring-boot,spring-security,Spring Boot,Spring Security,我使用SpringInitializer(at)构建了一个新的SpringBoot项目 我包括了很多东西,包括SpringSecurity,因为我以后会想要它 我有一个带有@GetMapping方法的@RestController。一切都很好。唯一的问题是当我点击URL时,我被引导到Spring安全登录表单(在这里输入“User”和在应用程序启动时生成的密码) 我的问题是,我现在如何关闭Spring安全性,这样就不会出现登录屏幕?我不想从我的项目中删除SpringSecurity,因为我以后可能
@GetMapping
方法的@RestController
。一切都很好。唯一的问题是当我点击URL时,我被引导到Spring安全登录表单(在这里输入“User”和在应用程序启动时生成的密码)
我的问题是,我现在如何关闭Spring安全性,这样就不会出现登录屏幕?我不想从我的项目中删除SpringSecurity,因为我以后可能会需要它
以下是我的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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
/*** ... ***/
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<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-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
/*** ... ***/
4.0.0
org.springframework.boot
spring启动程序父级
2.4.4
/*** ... ***/
org.springframework.boot
spring引导启动器数据jdbc
org.springframework.boot
spring引导启动器数据jpa
org.springframework.boot
弹簧启动启动器数据rest
org.springframework.boot
弹簧靴启动器jdbc
org.springframework.boot
弹簧启动安全
org.springframework.boot
SpringBootStarterWeb
mysql
mysql连接器java
运行时
org.springframework.boot
弹簧起动试验
测试
org.springframework.security
弹簧安全性试验
测试
/*** ... ***/
您可以在pom.xml文件中注释掉Spring安全依赖项。如果您有一个用于安全性的文件,您也可以通过在文件名开头添加“.”点来重命名它您可以在pom.xml文件中注释掉Spring安全性依赖项。如果您有一个用于安全的文件,您也可以通过在文件名开头添加“.”点来重命名它您可以添加一个配置类Extendes WebSecurity ConfigureAdapter您可以添加一个配置类Extendes WebSecurity ConfigureAdapter这是否回答了您的问题?这回答了你的问题吗?您应该更具体地说明如何配置它,并可以选择提供一些引用。您应该更具体地说明如何配置它,并可以选择提供一些引用。