SpringBoot 之安全快速入门
...小于 1 分钟
SpringBoot 之安全快速入门
QuickStart
(1)添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
(2)添加配置
spring.security.user.name = root
spring.security.user.password = root
spring.security.user.roles = USER
(3)启动应用后,访问任意路径,都会出现以下页面,提示你先执行登录操作。输入配置的用户名、密码(root/root)即可访问应用页面。
Powered by Waline v2.15.7