Spring Security:如何更改默认用户和密码? [英] Spring Security: How to change default user and password?

查看:81
本文介绍了Spring Security:如何更改默认用户和密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 pom.xml 中有 Spring Security,Spring Security 自动配置了默认用户和生成的密码:

I have Spring Security in my pom.xml, and Spring Security is automatically configured with a default user and generated password:

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

如何更改默认用户和密码?

How do I change the default user and password?

推荐答案

这可以在您的 application.properties 文件中轻松完成:

This can be easly done in your application.properties file:

spring.security.user.name=user # Default user name.
spring.security.user.password= # Password
spring.security.user.role= # A comma separated list of roles

这是文档.

这篇关于Spring Security:如何更改默认用户和密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆