Skip to content

Commit 4757003

Browse files
Merge pull request #24 from geekidea/dev
🏇 拦截器启用禁用配置,更改core包目录,下载上传拦截器,logback.xml优化显示行号, 1.2.2预发布 Former-commit-id: 61aff30677b4e1dc6a09e5428854c7c711c2f764
2 parents 9b1129c + 00865df commit 4757003

25 files changed

+363
-99
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/target/
2+
/classes
23
!.mvn/wrapper/maven-wrapper.jar
34

45
### STS ###

README-zh.md

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,20 @@
2121
</a>
2222
</p>
2323

24-
25-
#### SpringBoot Scaffolding
26-
2724
### spring-boot-plus是一套集成spring boot常用开发组件的后台快速开发框架
25+
> Spring-Boot-Plus是易于使用,快速,高效,功能丰富,开源的spring boot 脚手架.
2826
29-
## Purpose
27+
## 目标
3028
> 每个人都可以独立、快速、高效地开发项目!
3129
32-
> Everyone can develop projects independently, quickly and efficiently!
30+
## 文档
31+
#### [GITHUB](https://github.com/geekidea/spring-boot-plus) | [GITEE](https://gitee.com/geekidea/spring-boot-plus)
3332

34-
## Quick Start
35-
#### 官网地址:[springboot.plus](http://springboot.plus "springboot.plus")
36-
#### GITHUB:[https://github.com/geekidea/spring-boot-plus](https://github.com/geekidea/spring-boot-plus "spring-boot-plus github")
37-
#### GITEE:[https://gitee.com/geekidea/spring-boot-plus](https://gitee.com/geekidea/spring-boot-plus "spring-boot-plus gitee")
33+
#### Website:[springboot.plus](http://springboot.plus "springboot.plus")
3834

39-
# Architecture
35+
# 项目架构
4036
![spring-boot-plus-architecture.png](https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/img/spring-boot-plus-architecture.png)
4137

42-
4338
### 主要特性
4439
1. 集成spring boot 常用开发组件集、公共配置、AOP日志等
4540
2. 集成mybatis plus快速dao操作
@@ -79,8 +74,58 @@ jwt | 0.9.1 | json web token |
7974
hutool-all | 4.5.10 | 常用工具集 |
8075

8176

82-
## spring-boot-plus QQ技术交流群
83-
![spring-boot-plus QQ技术交流群](https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/img/spring-boot-plus-qq-group.png)
84-
85-
86-
#### 官网地址:[springboot.plus](http://springboot.plus "springboot.plus")
77+
## 使用
78+
### 克隆 spring-boot-plus
79+
```bash
80+
git clone https://github.com/geekidea/spring-boot-plus.git
81+
cd spring-boot-plus
82+
```
83+
84+
### Maven 构建
85+
> 默认使用local环境,对应配置文件:application-local.yml
86+
87+
```bash
88+
mvn clean package -Plocal
89+
```
90+
91+
### 项目入口类
92+
```java
93+
/**
94+
* spring-boot-plus 项目启动入口
95+
* @author geekidea
96+
* @since 2018-11-08
97+
*/
98+
@EnableAsync
99+
@EnableScheduling
100+
@EnableTransactionManagement
101+
@EnableConfigurationProperties
102+
@EnableAdminServer
103+
@MapperScan({"io.geekidea.springbootplus.**.mapper"})
104+
@SpringBootApplication
105+
public class SpringBootPlusApplication {
106+
107+
public static void main(String[] args) {
108+
// 启动spring-boot-plus
109+
ConfigurableApplicationContext context = SpringApplication.run(SpringBootPlusApplication.class, args);
110+
// 打印项目信息
111+
PrintApplicationInfo.print(context);
112+
}
113+
114+
}
115+
```
116+
117+
## 快速开始
118+
[快速开始](https://springboot.plus/guide/quick-start.html)
119+
120+
## 详细文档
121+
[https://springboot.plus](https://springboot.plus)
122+
123+
## 联系
124+
125+
- spring-boot-plus技术交流群
126+
127+
![spring-boot-plus QQ Group](https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/img/spring-boot-plus-qq-group.png)
128+
129+
130+
## License
131+
spring-boot-plus is under the Apache 2.0 license. See the [LICENSE](https://github.com/geekidea/spring-boot-plus/blob/master/LICENSE) file for details.

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
## Purpose
2828
> Everyone can develop projects independently, quickly and efficiently!
2929
30-
## DOCS
30+
## Docs
3131
#### [GITHUB](https://github.com/geekidea/spring-boot-plus) | [GITEE](https://gitee.com/geekidea/spring-boot-plus)
3232

3333
#### Website:[springboot.plus](http://springboot.plus "springboot.plus")
@@ -88,6 +88,32 @@ cd spring-boot-plus
8888
mvn clean package -Plocal
8989
```
9090

91+
### Project Main Class
92+
```java
93+
/**
94+
* spring-boot-plus Project Main Class
95+
* @author geekidea
96+
* @since 2018-11-08
97+
*/
98+
@EnableAsync
99+
@EnableScheduling
100+
@EnableTransactionManagement
101+
@EnableConfigurationProperties
102+
@EnableAdminServer
103+
@MapperScan({"io.geekidea.springbootplus.**.mapper"})
104+
@SpringBootApplication
105+
public class SpringBootPlusApplication {
106+
107+
public static void main(String[] args) {
108+
// Run spring-boot-plus
109+
ConfigurableApplicationContext context = SpringApplication.run(SpringBootPlusApplication.class, args);
110+
// Print Project Info
111+
PrintApplicationInfo.print(context);
112+
}
113+
114+
}
115+
```
116+
91117
## Quick Start
92118
[Quick Start](https://springboot.plus/guide/quick-start.html)
93119

pom.xml

Lines changed: 6 additions & 8 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.2.1.RELEASE</version>
24+
<version>1.2.2.RELEASE</version>
2525
<packaging>jar</packaging>
2626

2727
<name>spring-boot-plus</name>
@@ -56,7 +56,6 @@
5656
<druid.version>1.1.18</druid.version>
5757
<commons-io.version>2.6</commons-io.version>
5858
<reflections.version>0.9.11</reflections.version>
59-
<hibernate-validator.version>6.0.17.Final</hibernate-validator.version>
6059
<commons-codec.version>1.12</commons-codec.version>
6160
<commons-net.version>3.6</commons-net.version>
6261
<jansi.version>1.18</jansi.version>
@@ -108,6 +107,11 @@
108107
<groupId>org.springframework.boot</groupId>
109108
<artifactId>spring-boot-starter-json</artifactId>
110109
</dependency>
110+
<dependency>
111+
<groupId>org.springframework.boot</groupId>
112+
<artifactId>spring-boot-starter-validation</artifactId>
113+
</dependency>
114+
111115
<dependency>
112116
<groupId>org.springframework.boot</groupId>
113117
<artifactId>spring-boot-configuration-processor</artifactId>
@@ -212,12 +216,6 @@
212216
<version>${reflections.version}</version>
213217
</dependency>
214218

215-
<dependency>
216-
<groupId>org.hibernate.validator</groupId>
217-
<artifactId>hibernate-validator</artifactId>
218-
<version>${hibernate-validator.version}</version>
219-
</dependency>
220-
221219
<dependency>
222220
<groupId>org.fusesource.jansi</groupId>
223221
<artifactId>jansi</artifactId>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public static void main(String[] args) {
4747
ConfigurableApplicationContext context = SpringApplication.run(SpringBootPlusApplication.class, args);
4848
// 打印项目信息
4949
PrintApplicationInfo.print(context);
50+
/**
51+
* TODO 日志现实行号
52+
* 拦截器配置是否启用,参照文件上传拦截器
53+
*/
5054
}
5155

5256
}

src/main/java/io/geekidea/springbootplus/common/web/filter/RequestPathFilter.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ public class RequestPathFilter implements Filter {
3535
private static List<String> excludes = new ArrayList<>();
3636

3737
static {
38-
excludes.add("/api");
39-
excludes.add("/health/");
38+
// 控制台日志忽略spring boot admin访问路径
39+
excludes.add("/actuator");
40+
excludes.add("/instances");
4041
excludes.add("/logfile");
42+
excludes.add("/sba-settings.js");
43+
excludes.add("/assets/img/favicon.png");
4144
}
4245

4346
@Override
@@ -50,6 +53,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
5053
HttpServletRequest req = (HttpServletRequest) request;
5154
String path = req.getServletPath();
5255
String url = req.getRequestURL().toString();
56+
5357
boolean isOut = true;
5458
for (String p : excludes){
5559
if (path.startsWith(p)){

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
3535
@Override
3636
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
3737
throws Exception {
38+
log.info(request.getRequestURI());
3839
log.info("\n\nPermissionInterceptor...\n\n");
3940
return true;
4041
}

src/main/java/io/geekidea/springbootplus/config/core/SpringBootPlusConfig.java renamed to src/main/java/io/geekidea/springbootplus/core/SpringBootPlusConfig.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package io.geekidea.springbootplus.config.core;
16+
package io.geekidea.springbootplus.core;
1717

1818
import io.geekidea.springbootplus.common.aop.LogAop;
19-
import io.geekidea.springbootplus.common.web.interceptor.DownloadInterceptor;
20-
import io.geekidea.springbootplus.common.web.interceptor.PermissionInterceptor;
21-
import io.geekidea.springbootplus.common.web.interceptor.ResourceInterceptor;
22-
import io.geekidea.springbootplus.common.web.interceptor.TokenTimeoutInterceptor;
19+
import io.geekidea.springbootplus.common.web.interceptor.*;
20+
import io.geekidea.springbootplus.resource.web.interceptor.DownloadInterceptor;
21+
import io.geekidea.springbootplus.resource.web.interceptor.ResourceInterceptor;
22+
import io.geekidea.springbootplus.resource.web.interceptor.UploadInterceptor;
2323
import io.geekidea.springbootplus.security.interceptor.JwtInterceptor;
2424
import lombok.extern.slf4j.Slf4j;
2525
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -81,6 +81,16 @@ public TokenTimeoutInterceptor tokenTimeoutInterceptor(){
8181
return tokenTimeoutInterceptor;
8282
}
8383

84+
/**
85+
* 上传拦截器
86+
* @return
87+
*/
88+
@Bean
89+
public UploadInterceptor uploadInterceptor(){
90+
UploadInterceptor uploadInterceptor = new UploadInterceptor();
91+
return uploadInterceptor;
92+
}
93+
8494
/**
8595
* 资源拦截器
8696
* @return

src/main/java/io/geekidea/springbootplus/config/core/SpringBootPlusInterceptorConfig.java renamed to src/main/java/io/geekidea/springbootplus/core/SpringBootPlusInterceptorConfig.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.geekidea.springbootplus.config.core;
17+
package io.geekidea.springbootplus.core;
1818

1919
import lombok.Data;
2020
import lombok.experimental.Accessors;
@@ -50,6 +50,11 @@ public class SpringBootPlusInterceptorConfig implements Serializable {
5050
*/
5151
private InterceptorConfig resourceConfig;
5252

53+
/**
54+
* 上传拦截器
55+
*/
56+
private InterceptorConfig uploadConfig;
57+
5358
/**
5459
* 下载拦截器
5560
*/
@@ -58,6 +63,11 @@ public class SpringBootPlusInterceptorConfig implements Serializable {
5863
@Data
5964
public static class InterceptorConfig {
6065

66+
/**
67+
* 是否启用
68+
*/
69+
private boolean enabled;
70+
6171
/**
6272
* 排除路径
6373
*/

src/main/java/io/geekidea/springbootplus/config/core/SpringBootPlusProperties.java renamed to src/main/java/io/geekidea/springbootplus/core/SpringBootPlusProperties.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.geekidea.springbootplus.config.core;
17+
package io.geekidea.springbootplus.core;
1818

1919
import lombok.Data;
2020
import lombok.experimental.Accessors;
@@ -60,7 +60,6 @@ public class SpringBootPlusProperties {
6060
@NestedConfigurationProperty
6161
private SpringBootPlusInterceptorConfig interceptorConfig;
6262

63-
6463
/**
6564
* 上传目录
6665
*/

0 commit comments

Comments
 (0)