Spring boot turns off authentication (can be accessed without logging in)

1. Add coordinates to the pom.xml file

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

2. Application startup annotation modification

原注解:@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
修改后:@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class})

3. Access the project interface

Guess you like

Origin blog.csdn.net/Tom_sensen/article/details/114879684