报错:This generated password is for development use only. Your security configuration must be updated before running your application in production.

发布时间 2023-08-02 17:18:41作者: 夏往

项目报错:This generated password is for development use only. Your security configuration must be updated before running your application in production.

导致postman测试接口时报错:

401Unauthorized
Similar to 403 Forbidden, but specifically for usewhen authentication is possible but has failed ornot yet been provided.The response mustinclude a WWW-Authenticate header fieldcontaining a challenge applicable to therequested resource.

原因:springboot默认携带了一个springsecurity 密码

解决方法:在启动类上加上 SecurityAutoConfiguration.class

@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})