我试图通过添加security.ignore=/**
属性来禁用spring boot 2.0.2中的spring security,但它不能与我合作。
我的application.properties:
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=/**
结果:
答案 0 :(得分:3)
在主文件spring boot应用程序中添加此Java Annotations。
@EnableAutoConfiguration(exclude = {
SecurityAutoConfiguration.class
})
答案 1 :(得分:0)
添加此课程
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().anyRequest().permitAll();
}
}
答案 2 :(得分:0)
对我来说,这是技巧(类似于@ wilmer-villca的答案):
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)