我正在使用Spring Boot,并且正在使用spring-data-rest-hal-browser,一切似乎都很好,除非当我尝试访问URL时:localhost:8080我被重定向到http://localhost:8080/login以使用使用HAL浏览器浏览我的端点,然后出现一个屏幕,要求输入用户名和密码,而我却没有。
要登录的默认凭据是什么,如何更改它们或禁用登录选项?
这是我正在使用的依赖项:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
</dependency>
这是登录屏幕:
运行应用程序后,查看控制台输出。如果没有运行时异常,则应轻松找到凭据。默认情况下,用户名和密码始终不同,因此是从系统生成的。
为了更加清楚,登录页面带有此依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
此外,如果要为凭据设置一些值,请转到application.properties文件并添加这两行:
spring.security.user.name= your_username
spring.security.user.password= your_password