After the SpringBoot project starts, accessing any interface will jump to an inexplicable login login page

Description of the problem: After the SpringBoot project is started, accessing any interface will jump to an inexplicable login login page.
When we enter http://127.0.0.1:8080 or http://127.0.0.1:8080/demo.html in the web page Wait, they will jump to the following login interface. After searching for a long time, my project does not have the Hmtl interface. Later, I found out that it was because the Spring Security protection mechanism was turned on.
insert image description here
Solutions:
(1) Normal login:
Check the string of passwords returned to you after starting the project. The default account name is admin.
insert image description here
Enter admin and Using generated security password: 861e31f6-334d-4a44-bcd7-10477f297022 to enter the normal login interface.
insert image description here
(2) Removal mechanism
If you don't want this mechanism, you can also remove it. You only need to remove the following two dependencies in the pom.xml file, and you need to reload maven after removal.

<!--Spring Security依赖-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

<!--thymeleaf基于Spring security的标签-->
<dependency>
    <groupId>org.thymeleaf.extras</groupId>
    <artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>

Guess you like

Origin blog.csdn.net/blbyu/article/details/129106930