org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder 找不到依赖包
org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder 找不到依赖包,发现高版本的spring boot已经移除了这个类
需要改成以下这个
org.springframework.boot.jdbc.DataSourceBuilder
经验证
spring-boot-starter-parent 2.4.5 可用
关闭spring security的登录验证
引入security依赖后
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
访问该服务都会进入登录页登录
如果要去掉spring-security的登录页,在spring-boot 1.x 版本可以配置
security.basic.enabled=false
但是在spring-boot 2.x 版本中已经没有此项配置,可以加入以下配置类
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class CloseSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
//配置不需要登陆验证
http.authorizeRequests().anyRequest().permitAll().and().logout().permitAll();
}
}