浩晨众云网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
本文讲述Spring Boot整合Spring Security在方法上使用注解实现权限控制,使用自定义UserDetailService,从MySQL中加载用户信息。使用Security自带的MD5加密,对用户密码进行加密。页面模板采用thymeleaf引擎。
源码地址:https://github.com/li5454yong/springboot-security.git
1、引入pom依赖
org.springframework.boot spring-boot-starter-parent 1.4.4.RELEASE org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-security org.springframework.security.oauth spring-security-oauth3 org.springframework.boot spring-boot-starter-thymeleaf org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-jdbc mysql mysql-connector-java 5.1.34 com.alibaba druid 1.0.15