知乎專欄 | 多維度架構 | | | 微信號 netkiller-ebook | | | QQ群:128659835 請註明“讀者” |
目錄
如果在 maven 中引入了 spring security當你啟動 springboot 的時候會提示
Using generated security password: 1cd27b90-1208-4be2-ae8e-0f564ee427b8
預設用戶名是 user 可以這樣訪問
neo@MacBook-Pro ~ % curl -s http://user:1cd27b90-1208-4be2-ae8e-0f564ee427b8@localhost:8080/member/json {"status":false,"reason":"","code":0,"data":{}}
spring.security.user.name=test spring.security.user.password=test spring.security.user.role=USER
注意 Springboot 1.x
security.user.name=test security.user.password=passw0rdf security.user.role=USER
方法一
@SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) public class Application { public static void main(String[] args) { System.out.println("Web Starting..."); SpringApplication.run(Application.class, args); } }
Springboot 1.x 可以在 appliction.properties 中加入
security.basic.enabled=false