Skip to content

Commit 6922320

Browse files
1.2.0-RELEASE ⚡
Former-commit-id: 633f5b3311a89388462c9415257d3e4427636c09
1 parent 6d9ad49 commit 6922320

23 files changed

+252
-663
lines changed

pom.xml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<groupId>io.geekidea</groupId>
2323
<artifactId>spring-boot-plus</artifactId>
24-
<version>1.1.0.RELEASE</version>
24+
<version>1.2.0.RELEASE</version>
2525
<packaging>jar</packaging>
2626

2727
<name>spring-boot-plus</name>
@@ -49,7 +49,7 @@
4949
<spring-boot.version>2.1.6.RELEASE</spring-boot.version>
5050
<mybatis-plus-boot-starter.version>3.1.2</mybatis-plus-boot-starter.version>
5151
<fastjson.version>1.2.59</fastjson.version>
52-
<swagger2.version>2.7.0</swagger2.version>
52+
<swagger2.version>2.6.1</swagger2.version>
5353
<commons-lang3.version>3.9</commons-lang3.version>
5454
<velocity.version>1.7</velocity.version>
5555
<mysql.version>5.1.47</mysql.version>
@@ -65,10 +65,9 @@
6565
<jwt.version>0.9.1</jwt.version>
6666
<spring-boot-admin.version>2.1.6</spring-boot-admin.version>
6767

68-
<maven-compiler-source.version>1.8</maven-compiler-source.version>
69-
<maven-compiler-target.version>1.8</maven-compiler-target.version>
68+
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
7069
<maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
71-
<maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
70+
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
7271
</properties>
7372

7473
<dependencyManagement>
@@ -185,7 +184,6 @@
185184
<version>3.2.1</version>
186185
</dependency>
187186

188-
189187
<dependency>
190188
<groupId>commons-io</groupId>
191189
<artifactId>commons-io</artifactId>
@@ -233,18 +231,6 @@
233231
<scope>compile</scope>
234232
</dependency>
235233

236-
<!-- RabbitMQ -->
237-
<dependency>
238-
<groupId>org.springframework.boot</groupId>
239-
<artifactId>spring-boot-starter-amqp</artifactId>
240-
</dependency>
241-
242-
<!-- KafkaMQ -->
243-
<dependency>
244-
<groupId>org.springframework.kafka</groupId>
245-
<artifactId>spring-kafka</artifactId>
246-
</dependency>
247-
248234
<dependency>
249235
<groupId>org.yaml</groupId>
250236
<artifactId>snakeyaml</artifactId>
@@ -306,7 +292,6 @@
306292
</resources>
307293

308294
<plugins>
309-
310295
<!-- 由于没有直接继承spring-boot-starter-parent,此处修添加主类和设置repackage -->
311296
<plugin>
312297
<groupId>org.springframework.boot</groupId>
@@ -327,11 +312,13 @@
327312
<plugin>
328313
<groupId>org.apache.maven.plugins</groupId>
329314
<artifactId>maven-resources-plugin</artifactId>
315+
<version>${maven-resources-plugin.version}</version>
330316
</plugin>
331317

332318
<plugin>
333319
<groupId>org.apache.maven.plugins</groupId>
334320
<artifactId>maven-compiler-plugin</artifactId>
321+
<version>${maven-compiler-plugin.version}</version>
335322
<configuration>
336323
<source>${java.version}</source>
337324
<target>${java.version}</target>

src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
public class SpringBootPlusApplication {
4444

4545
public static void main(String[] args) {
46-
// 启动项目,准备工作提示
47-
PrintApplicationInfo.printTip();
4846
// 启动spring-boot-plus
4947
ConfigurableApplicationContext context = SpringApplication.run(SpringBootPlusApplication.class, args);
5048
// 打印项目信息

src/main/java/io/geekidea/springbootplus/common/web/interceptor/PermissionInterceptor.java

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
package io.geekidea.springbootplus.common.web.interceptor;
1818

1919
import lombok.extern.slf4j.Slf4j;
20-
import org.springframework.beans.factory.annotation.Autowired;
21-
import org.springframework.data.redis.core.RedisTemplate;
2220
import org.springframework.web.servlet.ModelAndView;
2321
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
2422

@@ -34,91 +32,15 @@
3432
@Slf4j
3533
public class PermissionInterceptor extends HandlerInterceptorAdapter {
3634

37-
@Autowired
38-
private RedisTemplate redisTemplate;
39-
4035
@Override
4136
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
4237
throws Exception {
43-
44-
// // 如果访问的不是控制器,则跳出,继续执行下一个拦截器
45-
// if (!(handler instanceof HandlerMethod)) {
46-
// return true;
47-
// }
48-
//
49-
// // 获取token
50-
// String token = request.getHeader(CommonConstant.TOKEN);
51-
// boolean hastoken = false;
52-
// if (StringUtils.isNotBlank(token)){
53-
// hastoken = true;
54-
// }
55-
// if (hastoken == false){
56-
// token = request.getParameter(CommonConstant.TOKEN);
57-
// if (StringUtils.isNotBlank(token)){
58-
// hastoken = true;
59-
// }
60-
// }
61-
// if (hastoken == false){
62-
// // 请传入token
63-
// ApiResult apiResult = new ApiResult();
64-
// apiResult.setCode(ResponseCode.NOT_PERMISSION);
65-
// apiResult.setMsg("请传入有效的token");
66-
// HttpServletResponseUtil.printJSON(response,apiResult);
67-
// return false;
68-
// }
69-
//
70-
// // 判断是否登陆
71-
//// LoginSysUserVo loginSysUserVo = (LoginSysUserVo) redisTemplate.opsForValue().get(token);
72-
//// if (loginSysUserVo == null){
73-
//// ResponseResult responseResult = new ResponseResult();
74-
//// responseResult.setCode(ResponseCode.NOT_LOGIN);
75-
//// responseResult.setMsg("token无效或已过期,请重新登录");
76-
//// HttpServletResponseUtil.printJSON(response,responseResult);
77-
//// return false;
78-
//// }
79-
//
80-
// // 判断是否有权限
81-
//// String path = request.getServletPath();
82-
// // 获取到权限路径
83-
// // TODO 需判断第一次初始化信息
84-
//// List<String> allFuncActions = loginSysUserVo.getAllFuncActions();
85-
//// if (CollectionUtils.isEmpty(allFuncActions)){
86-
//// HttpServletResponseUtil.printJSON(response,new ResponseResult(ResponseCode.NOT_PERMISSION,"该用户没有任何权限功能"));
87-
//// return false;
88-
//// }
89-
//
90-
//// // 排除不需要权限验证的路径
91-
//// if (isExistsPath(path)){
92-
//// // 将当前登录用户保存到request中
93-
//// request.setAttribute(CommonConstant.LOGIN_SYS_USER, loginSysUserVo);
94-
//// return true;
95-
//// }
96-
////
97-
//// // 验证是否有操作权限
98-
//// if (!allFuncActions.contains(path)){
99-
//// HttpServletResponseUtil.printJSON(response,new ResponseResult(ResponseCode.NOT_PERMISSION,"该用户没有此操作权限"));
100-
//// return false;
101-
//// }
102-
//
103-
// // 将当前登录用户保存到request中
104-
//// request.setAttribute(CommonConstant.LOGIN_SYS_USER, loginSysUserVo);
105-
38+
log.info("\n\nPermissionInterceptor...\n\n");
10639
return true;
10740
}
10841

10942
@Override
11043
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
11144
}
11245

113-
// public boolean isExistsPath(String path){
114-
// if (functionExcludePaths == null || functionExcludePaths.length == 0){
115-
// return false;
116-
// }
117-
// for (String functionExcludePath : functionExcludePaths){
118-
// if (path.startsWith(functionExcludePath)){
119-
// return true;
120-
// }
121-
// }
122-
// return false;
123-
// }
12446
}

src/main/java/io/geekidea/springbootplus/config/SpringBootPlusConfig.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/main/java/io/geekidea/springbootplus/config/WebMvcConfig.java

Lines changed: 21 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@
1818

1919
import io.geekidea.springbootplus.common.web.interceptor.PermissionInterceptor;
2020
import io.geekidea.springbootplus.common.web.interceptor.TokenTimeoutInterceptor;
21+
import io.geekidea.springbootplus.config.core.SpringBootPlusProperties;
2122
import io.geekidea.springbootplus.security.interceptor.JwtInterceptor;
2223
import lombok.extern.slf4j.Slf4j;
23-
import org.springframework.beans.factory.annotation.Value;
24+
import org.springframework.beans.factory.annotation.Autowired;
2425
import org.springframework.context.annotation.Configuration;
2526
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
2627
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
2728
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
2829

29-
import java.util.Arrays;
30-
3130
/**
3231
* @author geekidea
3332
* @date 2018-11-08
@@ -36,61 +35,35 @@
3635
@Slf4j
3736
public class WebMvcConfig implements WebMvcConfigurer {
3837

39-
@Value("${spring-boot-plus.interceptor.jwt.exclude.path}")
40-
private String[] jwtExcludePaths;
41-
42-
@Value("${spring-boot-plus.interceptor.token-timeout.exclude.path}")
43-
private String[] tokenTimeoutExcludePaths;
44-
45-
@Value("${spring-boot-plus.interceptor.permission.exclude.path}")
46-
private String[] permissionExcludePaths;
38+
@Autowired
39+
private SpringBootPlusProperties springBootPlusProperties;
4740

48-
/**
49-
* jwt token验证拦截器
50-
* @return
51-
*/
52-
// @Bean
53-
public JwtInterceptor jwtInterceptor(){
54-
return new JwtInterceptor();
55-
}
41+
@Autowired
42+
private JwtInterceptor jwtInterceptor;
5643

57-
/**
58-
* 权限拦截器
59-
* @return
60-
*/
61-
// @Bean
62-
public PermissionInterceptor permissionInterceptor(){
63-
return new PermissionInterceptor();
64-
}
65-
66-
/**
67-
* TOKEN超时拦截器
68-
* @return
69-
*/
70-
// @Bean
71-
public TokenTimeoutInterceptor tokenTimeoutInterceptor(){
72-
return new TokenTimeoutInterceptor();
73-
}
44+
@Autowired
45+
private PermissionInterceptor permissionInterceptor;
7446

47+
@Autowired
48+
private TokenTimeoutInterceptor tokenTimeoutInterceptor;
7549

7650
@Override
7751
public void addInterceptors(InterceptorRegistry registry) {
78-
log.info("PermissionInterceptor excludePaths : {}", Arrays.toString(permissionExcludePaths));
79-
//
80-
// registry.addInterceptor(jwtInterceptor())
81-
// .addPathPatterns("/**")
82-
// .excludePathPatterns(jwtExcludePaths);
8352

84-
// 1.TOKEN超时拦截器
85-
// registry.addInterceptor(tokenTimeoutInterceptor())
53+
// // JWT拦截器
54+
// registry.addInterceptor(jwtInterceptor)
55+
// .addPathPatterns("/**")
56+
// .excludePathPatterns(springBootPlusProperties.getInterceptorConfig().getJwtConfig().getExcludePath());
57+
//
58+
// // TOKEN超时拦截器
59+
// registry.addInterceptor(tokenTimeoutInterceptor)
8660
// .addPathPatterns("/**")
87-
// .excludePathPatterns(tokenTimeoutExcludePaths);
61+
// .excludePathPatterns(springBootPlusProperties.getInterceptorConfig().getTokenTimeoutConfig().getExcludePath());
8862
//
89-
// // 2.权限拦截器
90-
// registry.addInterceptor(permissionInterceptor())
63+
// // 权限拦截器
64+
// registry.addInterceptor(permissionInterceptor)
9165
// .addPathPatterns("/**")
92-
// .excludePathPatterns(permissionExcludePaths)
93-
// .excludePathPatterns(operationPlatformIncludePaths);
66+
// .excludePathPatterns(springBootPlusProperties.getInterceptorConfig().getPermissionConfig().getExcludePath());
9467

9568
}
9669

0 commit comments

Comments
 (0)