首页 > 解决方案 > 在 Spring Boot 2.0.2 中禁用 Spring Security

问题描述

security.ignore=/**我正在尝试通过添加属性来禁用 Spring Boot 2.0.2 中的 Spring Security,但它不适用于我。

我的应用程序属性:

spring.datasource.url = jdbc:mysql://localhost:3306/smile
spring.datasource.username = root
spring.datasource.password =
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

# suppress inspection "SpringBootApplicationProperties"
security.ignored=/**

结果:

在此处输入图像描述

标签: spring-bootspring-security

解决方案


在您的主文件 Spring Boot 应用程序中添加此 Java Annotations。

@EnableAutoConfiguration(exclude = { 
    SecurityAutoConfiguration.class 
})

推荐阅读