之前工做用的登錄服務也不接SpringSecurity,因此這裏寫篇博客記錄一下。使用SpringBoot接入SpringSecurity,咱們先加入一些簡單的依賴:spring
其中用的springBoot的版本是:安全
而後咱們寫一個SpringSecurity的配置:ui
authorizeRequests()定義哪些URL須要被保護、哪些不須要被保護
configureGlobal(AuthenticationManagerBuilder auth)方法,在內存中建立了一個用戶,這裏須要設置CustomPasswordEncoder()。code