فهرست منبع

重构权限系统

宋悦 8 سال پیش
والد
کامیت
02350e40a8

+ 4 - 0
exam-work-api/pom.xml

@@ -24,6 +24,10 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
         <dependency>
             <groupId>io.springfox</groupId>
             <artifactId>springfox-swagger2</artifactId>

+ 6 - 1
exam-work-main/src/main/java/cn/com/qmth/examcloud/service/examwork/AccessControlConfig.java

@@ -1,8 +1,10 @@
 package cn.com.qmth.examcloud.service.examwork;
 
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Profile;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.servlet.config.annotation.CorsRegistry;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@@ -17,9 +19,12 @@ import cn.com.qmth.examcloud.common.uac.AccessCtrlInterceptor;
 //@Profile("prod")
 public class AccessControlConfig extends WebMvcConfigurerAdapter {
 
+	@Autowired
+	RedisTemplate redisTemplate;
+
 	@Bean
 	public AccessCtrlInterceptor getInterceptor() {
-		return new AccessCtrlInterceptor();
+		return new AccessCtrlInterceptor(redisTemplate);
 	}
 
     @Override

+ 3 - 0
exam-work-main/src/main/resources/application-test.properties

@@ -1,3 +1,6 @@
 spring.datasource.url=jdbc:mysql://192.168.1.74:3306/exam_cloud_yun?useUnicode=true&characterEncoding=UTF-8
 spring.datasource.username=root
 spring.datasource.password=root
+
+spring.redis.host=127.0.0.1
+spring.redis.port=6379