Skip to content

Commit 1dc6ac3

Browse files
committed
基础框架升级完成
1 parent eaee0c0 commit 1dc6ac3

33 files changed

+985
-221
lines changed

README.md

+23-32
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
##更新记录
22

3-
近段时间一直忙公司的项目,忽略的本项目的更新,最近有时间了,结合ISSUES修复了jwt的一些不理想之处,更新内容如下
3+
###更新日期2018-06-14
4+
更新说明:SpringBootAdmin已正式更名为Geek-Framework
5+
* 升级springboot1.5为了2.0,2.0版本变动比较大,1.5版本不可直接更新,如有需要可以查看更新记录
6+
* 整合了J2Cache二级缓存功能,J2Cache具体功能详见<http://www.oschina.net/p/j2cache>
7+
* 原有单redis缓存功能仍可使用,具体仍用方法见代码注释
48

9+
PS:现有代码中有J2Cache的源代码,原因是因为发现了一个J2Cache的BUG,官方版本已经更新,但未同步至中央仓库,暂时用源码替代,待仓库更新后移除现在源代码
510

611
###更新日期2018-05-30
712

@@ -25,16 +30,16 @@
2530

2631
***
2732

28-
# SpringBootAdmin 微服务快速开发脚手架
33+
# Geek-Framework 微服务快速开发脚手架
2934

3035
## 平台简介
3136

32-
SpringBootAdmin是基于多个优秀的开源项目,高度整合封装而成的高效,高性能,强安全性的**开源**Java微服务快速开发框架。
37+
Geek-Framework是基于多个优秀的开源项目,高度整合封装而成的高效,高性能,强安全性的**开源**Java微服务快速开发框架。
3338

34-
SpringBootAdmin是在SpringBoot基础上搭建的一个Java基础开发框架,以Spring MVC为模型视图控制器,MyBatis为数据访问层,
35-
Apache Shiro为权限授权层,Ehcahe或**redis**对常用数据进行缓存
39+
Geek-Framework是在SpringBoot基础上搭建的一个Java基础开发框架,以Spring MVC为模型视图控制器,MyBatis为数据访问层,
40+
Apache Shiro为权限授权层,Ehcahe、redis或**j2cache**进行缓存
3641

37-
SpringBootAdmin主要定位于微应用的开发,已内置后台系统的基础功能,用户管理、角色管理、权限管理、会员管理、日志管理等;前台已经实现用户登录,注册等基础功能。
42+
Geek-Framework主要定位于微应用的开发,已内置后台系统的基础功能,用户管理、角色管理、权限管理、会员管理、日志管理等;前台已经实现用户登录,注册等基础功能。
3843
同时前后台会员实现分表管理,可扩展多角色系统、多权限系统。
3944
采用分层设计、双重验证、提交数据安全编码、密码加密、访问验证、数据权限验证。
4045
使用Maven做项目管理,提高项目的易开发性、扩展性。
@@ -51,19 +56,19 @@ SpringBootAdmin主要定位于微应用的开发,已内置后台系统的基
5156

5257
1、后端
5358

54-
* 核心框架:SpringBoot 1.5.2.RELEASE
55-
* 集成运行框架:Tomcat 8.5.11
56-
* 安全框架:Apache Shiro 1.2
57-
* 视图框架:Spring MVC 4.1
58-
* 服务端验证:Hibernate Validator 5.3.4
59-
* 布局框架:Thymeleaf 1.5.2
59+
* 核心框架:SpringBoot 2.0.2.RELEASE
60+
* 集成运行框架:Tomcat 8.5.31
61+
* 安全框架:Apache Shiro 1.4
62+
* 视图框架:Spring MVC 5.0.6
63+
* 服务端验证:Hibernate Validator 6.0.9
64+
* 布局框架:Thymeleaf 3.0.9
6065
* 持久层框架:MyBatis 3.3.1
6166
* 数据处理框架:Mapper 3.3.9
6267
* 数据库连接池:Alibaba Druid 1.0
63-
* 缓存框架:Ehcache 2.6、Redis
64-
* 日志管理:SLF4J 1.7、Log4j
68+
* 缓存框架:Ehcache 3、Redis
69+
* 日志管理:Log4j
6570
* TOKEN模式: jsonwebtoken 0.6
66-
* 工具类:Apache Commons、Jackson 2.8.5、Junit 4.12
71+
* 工具类:Apache Commons、Jackson 2.9.5
6772

6873
2、前端
6974

@@ -80,7 +85,7 @@ SpringBootAdmin主要定位于微应用的开发,已内置后台系统的基
8085

8186
* 服务器中间件:项目默认支持Tomcat8.5版本,如果需要打包部署到已有的Tomcat需做特殊处理后续会更新。
8287
* 数据库支持:目前仅提供MySql数据库的支持,但不限于数据库,后续会增加其它数据库支持接口,
83-
* 开发环境:Java1.7以上、IDEA、Maven 3.1以上、Git
88+
* 开发环境:Java1.8以上、IDEA、Maven 3.1以上、Git
8489

8590
## 安全考虑
8691

@@ -93,7 +98,7 @@ SpringBootAdmin主要定位于微应用的开发,已内置后台系统的基
9398

9499
## 演示地址
95100

96-
* <http://demo.geekcattle.cc/> &nbsp; 用户名:admin 密码:admin
101+
* <http://www.geekcattle.com/> &nbsp; 用户名:admin 密码:admin
97102

98103
PS:测试数据库会不定期恢复。
99104

@@ -103,9 +108,8 @@ PS:测试数据库会不定期恢复。
103108
2. 修改src\main\resources\application.properties、application-dev.properties、application-pro.properties文件中的数据库设置参数(application-dev.properties为开发环境的相应参数,application-pro.properties为部署环境的相应参数)。
104109
3. 根据修改参数创建对应MySql数据库用户和参数。
105110
4. 运行mvn package脚本,即可创建项目jar文件,同时也可以通过java -jar *.jar 即可本地预览
106-
5. 将src\main\resources\geekcattle.sql导入本地数据库即可
111+
5. data\geekcattle.sql导入本地数据库即可
107112
6. 最高管理员账号,用户名:admin 密码:admin
108-
7. 由于项目只是基础功能实现,可能还有一些没有优化到的时候,后续会持续优化和改进
109113

110114
## 如何交流、反馈、参与贡献?
111115

@@ -125,19 +129,6 @@ PS:测试数据库会不定期恢复。
125129
6. 你可以二次包装出售,**但还请保留文件中的版权和作者信息**,并在你的产品说明中注明SpringBootAdmin。
126130
7. 你可以以任何方式获得,你可以修改包名或类名,**但还请保留文件中的版权和作者信息**
127131

128-
## 项目起因
129-
130-
本人是一个全栈开发人员,精通前后台开发,以前一直用SSH、SSM框架开发,大多数时候也都用已有项目进行二次开发或用核心功能来做业务功能开发,一直想自己做一套属于自己的东西项目,
131-
很多时候感觉自己有很强的强迫证,都说大多数程序员都有,不知道是不是这样的,所以经过自己开发项目经验不断积累现在已经有了能够架构基础项目,
132-
后来又接触到了SpringBoot,喜欢SpringBoot的原因是SpringBoot省掉了很多的XML的配置,使我们能够更多关注我们业务的开发。
133-
134-
在和很多同事和朋友交流的时候发现大多数人都是采用别人开发好的东西,很少有人去研究底层框架的搭建,由于SSH和SSM框架已经很多,所以就萌生了开发一套属于自己的底层的基础框架,
135-
不涉及任何业务逻辑,大多数二次开发时候我们可以需一个干净的框架让我们来做系统的业务开发,这也正是SpingBootAdmin诞生的原因,希望这个项目能够给一些人带来一些帮助。
136-
137-
## 个人技能
138-
139-
JAVA、PHP、HTML、CSS、JQ、BootStrap、Vue、Mysql、Redis、SVN、GIT、Apache、Nginx、Tomcat、WindowServer、Ubuntu
140-
141132
## 捐赠支持
142133

143134
![icon](https://github.com/liu-peiyu/SpringBootAdmin/blob/master/src/main/resources/static/assets/pay.jpg?raw=true)
File renamed without changes.

jwt使用.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030

3131
##5、验证token
3232

33-
token验证是通过filter完成的,filter验证成功之后将解析出的用户信息通过request的方式传递到需要执行的方法(此处如果能结合shiro实现为最佳,还在探索中,如有更好的方案请指正)
33+
token验证是通过filter完成的,filter验证成功之后将解析出的用户信息通过shiro的token功能进行登录,更方便的调用用户信息
3434

35-
##6、业务处理
36-
37-
在实际业务上通过request方法获取到用户信息进行用户数据的处理
3835

pom.xml

+18-36
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4-
<groupId>com.geek</groupId>
5-
<artifactId>SpringBootAdmin</artifactId>
6-
<packaging>jar</packaging>
7-
<version>1.0-SNAPSHOT</version>
8-
<name>SpringBootAdmin</name>
9-
<url>http://app.geekcattle.cc</url>
4+
<groupId>com.geekcattle</groupId>
5+
<artifactId>geek-framwork</artifactId>
6+
<packaging>pom</packaging>
7+
<version>2.0-SNAPSHOT</version>
8+
<name>Geek-Framework</name>
9+
<url>http://www.geekcattle.com</url>
1010

1111
<parent>
1212
<groupId>org.springframework.boot</groupId>
1313
<artifactId>spring-boot-starter-parent</artifactId>
14-
<version>2.0.1.RELEASE</version>
15-
<relativePath></relativePath>
14+
<version>2.0.2.RELEASE</version>
15+
<relativePath/>
1616
</parent>
1717

1818
<properties>
@@ -43,15 +43,12 @@
4343
<groupId>org.springframework.boot</groupId>
4444
<artifactId>spring-boot-starter-web</artifactId>
4545
</dependency>
46-
<!-- <dependency>
47-
<groupId>org.springframework.boot</groupId>
48-
<artifactId>spring-boot-configuration-processor</artifactId>
49-
<optional>true</optional>
50-
</dependency>-->
46+
5147
<dependency>
5248
<groupId>org.springframework.boot</groupId>
5349
<artifactId>spring-boot-starter-jdbc</artifactId>
5450
</dependency>
51+
5552
<dependency>
5653
<groupId>org.springframework.boot</groupId>
5754
<artifactId>spring-boot-starter-aop</artifactId>
@@ -86,15 +83,7 @@
8683
<artifactId>spring-context-support</artifactId>
8784
</dependency>
8885

89-
<!--在用maven 编译,打包过程中回出现javax.servlet找不到的情况,所以需要在这里配置-->
90-
<!--<dependency>
91-
<groupId>javax.servlet</groupId>
92-
<artifactId>javax.servlet-api</artifactId>
93-
<version>${servlet.version}</version>
94-
</dependency>-->
95-
9686
<!-- shiro spring. -->
97-
9887
<dependency>
9988
<groupId>org.apache.shiro</groupId>
10089
<artifactId>shiro-spring</artifactId>
@@ -166,22 +155,23 @@
166155
<dependency>
167156
<groupId>com.fasterxml.jackson.core</groupId>
168157
<artifactId>jackson-core</artifactId>
158+
<version>2.9.5</version>
169159
</dependency>
170160
<dependency>
171161
<groupId>com.fasterxml.jackson.core</groupId>
172162
<artifactId>jackson-annotations</artifactId>
163+
<version>2.9.5</version>
173164
</dependency>
174-
175165
<dependency>
176-
<groupId>com.alibaba</groupId>
177-
<artifactId>druid</artifactId>
178-
<version>1.0.11</version>
166+
<groupId>com.fasterxml.jackson.core</groupId>
167+
<artifactId>jackson-databind</artifactId>
168+
<version>2.9.5</version>
179169
</dependency>
180170

181171
<dependency>
182172
<groupId>com.alibaba</groupId>
183-
<artifactId>fastjson</artifactId>
184-
<version>1.2.21</version>
173+
<artifactId>druid</artifactId>
174+
<version>1.0.11</version>
185175
</dependency>
186176

187177
<dependency>
@@ -223,17 +213,9 @@
223213
<version>${mapper.version}</version>
224214
</dependency>
225215

226-
<!-- https://mvnrepository.com/artifact/junit/junit -->
227-
<dependency>
228-
<groupId>junit</groupId>
229-
<artifactId>junit</artifactId>
230-
<!--<version>4.11</version>-->
231-
<scope>test</scope>
232-
</dependency>
233-
234216
</dependencies>
235217
<build>
236-
<finalName>spring-boot-admin</finalName>
218+
<finalName>geek-framework</finalName>
237219
<plugins>
238220
<plugin>
239221
<groupId>org.springframework.boot</groupId>

src/main/java/com/geekcattle/Application.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010
import org.springframework.transaction.annotation.EnableTransactionManagement;
1111
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
1212

13-
@EnableWebMvc//启动MVC
1413
@EnableTransactionManagement // 启注解事务管理
1514
@SpringBootApplication//SpringBoot启动核心
16-
public class Application extends SpringBootServletInitializer {
15+
public class Application {
1716
//启动文件
1817
public static void main(String[] args){
1918
SpringApplication.run(Application.class, args);

src/main/java/com/geekcattle/core/WebMvcConfig.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
2424
@Override
2525
public void addInterceptors(InterceptorRegistry registry) {
2626
logger.info("执行InterceptorRegistry");
27-
//registry.addInterceptor(resourceInterceptor);
28-
registry.addInterceptor(resourceInterceptor).addPathPatterns("/**").excludePathPatterns("/static/**");
27+
registry.addInterceptor(resourceInterceptor);
2928
}
3029

3130
}

src/main/java/com/geekcattle/core/j2cache/cache/support/ShiroJ2Cache.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.geekcattle.core.j2cache.cache.support;
22

3+
import com.geekcattle.model.console.Admin;
34
import net.oschina.j2cache.CacheChannel;
45
import net.oschina.j2cache.CacheObject;
56
import org.apache.shiro.cache.Cache;
@@ -20,19 +21,19 @@ public ShiroJ2Cache(String region, CacheChannel channel) {
2021
}
2122

2223
public V get(K key) throws CacheException {
23-
CacheObject val = this.channel.get(region, (String) key);
24+
CacheObject val = this.channel.get(region, key.toString());
2425
if (val == null)
2526
return null;
2627
return (V) val.getValue();
2728
}
2829

2930
public V put(K key, V value) throws CacheException {
30-
this.channel.set(region, (String)key, value);
31+
this.channel.set(region, key.toString(), value);
3132
return null;
3233
}
3334

3435
public V remove(K key) throws CacheException {
35-
this.channel.evict(region, (String)key);
36+
this.channel.evict(region, key.toString());
3637
return null;
3738
}
3839

Original file line numberDiff line numberDiff line change
@@ -1,36 +1,29 @@
11
package com.geekcattle.core.j2cache.cache.support;
22

3+
import com.geekcattle.core.redis.RedisConfiguration;
34
import net.oschina.j2cache.CacheChannel;
45
import net.oschina.j2cache.J2Cache;
5-
import org.apache.shiro.ShiroException;
6-
import org.apache.shiro.cache.AbstractCacheManager;
76
import org.apache.shiro.cache.Cache;
87
import org.apache.shiro.cache.CacheException;
9-
import org.apache.shiro.util.Destroyable;
10-
import org.apache.shiro.util.Initializable;
8+
import org.apache.shiro.cache.CacheManager;
119
import org.springframework.beans.factory.annotation.Autowired;
10+
import org.springframework.stereotype.Repository;
1211

13-
public class ShiroJ2CacheCacheManager extends AbstractCacheManager implements Initializable, Destroyable {
12+
import javax.annotation.Resource;
13+
14+
@Repository("shiroJ2CacheCacheManager")
15+
public class ShiroJ2CacheCacheManager implements CacheManager {
1416

1517
@Autowired
1618
private CacheChannel channel;
1719

18-
@Override
19-
public void init() throws ShiroException {
20-
channel = J2Cache.getChannel();
21-
}
22-
23-
public void destroy() throws Exception {
24-
/*if (channel != null)
25-
channel.close();*/
26-
}
20+
@Resource
21+
private RedisConfiguration redisConfiguration;
2722

2823
@Override
29-
protected Cache<Object, Object> createCache(String name) throws CacheException {
24+
public <K, V> Cache<K, V> getCache(String name) throws CacheException {
3025
if (channel == null)
3126
channel = J2Cache.getChannel();
32-
return new ShiroJ2Cache<Object, Object>(name, channel);
27+
return new ShiroJ2Cache<K, V>(redisConfiguration.getCachePrefix(), channel);
3328
}
34-
35-
3629
}

0 commit comments

Comments
 (0)