For further reference, please consider the following sections:
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Spring Security
- Spring Configuration Processor
- Spring Web
- Spring Boot DevTools
The following guides illustrate how to use some features concretely:
- Securing a Web Application
- Spring Boot and OAuth2
- Authenticating a User with LDAP
- Building a RESTful Web Service
- Serving Web Content with Spring MVC
- Building REST services with Spring
1)、环境在Spring Boot 2.2.6.RELEASE 和 Spring Security 2.2.6.RELEASE的时候无论配置没配置对应的安全拦截类,都会有默认的安全验证和访问控制,即需要先登录在进入web
解决方案:
- 在
Spring Boot的配置文件中添加Spring Security的用户信息。在进入web时使用此账户进行登录- 在启动类处禁用
spring Security的安全设置,禁用设置如下:
package com.yq;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = {"com.yq"})
@EnableAutoConfiguration(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
})
public class WebSecurityDemoApp {
private static final Logger log = LoggerFactory.getLogger(WebSecurityDemoApp.class);
public static void main(String[] args) {
SpringApplication.run(WebSecurityDemoApp.class, args);
}
}
最高支持
Spring Boot 2.0.9.RELEASE版本