Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
f92d4358
Commit
f92d4358
authored
Jul 20, 2017
by
naan1993
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into dev
parents
23440935
a41c71f4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
39 additions
and
29 deletions
+39
-29
README.md
+3
-3
doc/多机环境部署注意事项.md
+8
-4
pom.xml
+0
-0
src/main/java/com/stylefeng/guns/config/SpringSessionConfig.java
+16
-17
src/main/java/com/stylefeng/guns/config/web/ShiroConfig.java
+2
-2
src/main/java/com/stylefeng/guns/core/intercept/SessionTimeoutInterceptor.java
+2
-0
src/main/java/com/stylefeng/guns/core/template/engine/base/GunsTemplateEngine.java
+6
-1
src/main/java/com/stylefeng/guns/modular/system/controller/DeptController.java
+1
-1
src/main/resources/application.yml
+1
-1
No files found.
README.md
View file @
f92d4358
...
...
@@ -30,7 +30,7 @@ Guns项目代码简洁,注释丰富,上手容易,同时Guns包含许多基础模
7.
修复添加一级菜单不生效的问题
### 如果不喜欢SpringBoot?
如果您不喜欢用SpringBoot,或者您是一个spring初学者,您可以切换到
[
Guns V1.0(点击这里)
](
http://git.oschina.net/naan1993/guns/tree/v1.0/
)
分支,
如果您不喜欢用SpringBoot,或者您是一个spring初学者,您可以切换到
***[Guns V1.0(点击这里)](http://git.oschina.net/naan1993/guns/tree/v1.0/)**
*
分支,
Guns V1.0基于spring的java bean方式配置项目,同样简洁易上手.
注:SpringBoot强大的Auto Config和统一的依赖管理极大的简化了spring配置和maven依赖,在不了解其都配置了哪些东西的基础上可能会对初学者有一定困扰,所以建议初学者先看Guns V1.0
...
...
@@ -51,7 +51,7 @@ Guns V1.0基于spring的java bean方式配置项目,同样简洁易上手.
1.
导入sql/guns.sql文件到mysql数据库
2.
以maven方式导入项目到ide
3.
修改application.yml中的数据库相关的配置,改为您本机的数据库配置
4.
启动项目,管理员
账号admin/密码111111
4.
启动项目,管理员
***账号admin/密码111111**
*
### 如何启动项目
Guns目前支持三种启动方式:
...
...
@@ -75,7 +75,7 @@ java -jar guns-1.0.0-SNAPSHOT.jar
并打包放入到tomcat中执行
### 注意
建议本项目用jdk1.8,经测试jdk1.7登录页面会导致css丢失
最新版项目最低支持jdk1.7
## 所用框架
### 前端
...
...
doc/多机环境部署注意事项.md
View file @
f92d4358
# 多机环
境部署注意事项
# 多机环
境部署注意事项
...
...
@@ -2,7 +2,7 @@
多机环境把session托管给redis存储,所以要部署和配置redis,另外需要注意的是开启相关配置
## 注意事项如下
1.
单机环境下不需要依赖spring-session,所以需要把相关依赖
改为compoile
1.
单机环境下不需要依赖spring-session,所以需要把相关依赖
的注释打开
```
<dependency>
<groupId>org.springframework.session</groupId>
...
...
@@ -20,4 +20,9 @@ spring.redis.host=xxx
spring.redis.port=xxx
spring.redis.password=xxx
```
4.
如需配置session失效时间,请在SpringSessionConfig类中修改maxInactiveIntervalInSeconds属性值
\ No newline at end of file
4.
需要把SpringSessionConfig类中的注释打开
```
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 1800)
```
5.
如需配置session失效时间,请在SpringSessionConfig类中修改maxInactiveIntervalInSeconds属性值
pom.xml
View file @
f92d4358
This diff is collapsed.
Click to expand it.
src/main/java/com/stylefeng/guns/config/SpringSessionConfig.java
View file @
f92d4358
package
com
.
stylefeng
.
guns
.
config
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession
;
/**
* spring session配置
*
* @author fengshuonan
* @date 2017-07-13 21:05
*/
@EnableRedisHttpSession
(
maxInactiveIntervalInSeconds
=
1800
)
//session过期时间
@ConditionalOnProperty
(
prefix
=
"guns"
,
name
=
"spring-session-open"
,
havingValue
=
"true"
)
public
class
SpringSessionConfig
{
}
package
com
.
stylefeng
.
guns
.
config
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
/**
* spring session配置
*
* @author fengshuonan
* @date 2017-07-13 21:05
*/
//@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 1800) //session过期时间 如果部署多机环境,需要打开注释
@ConditionalOnProperty
(
prefix
=
"guns"
,
name
=
"spring-session-open"
,
havingValue
=
"true"
)
public
class
SpringSessionConfig
{
}
src/main/java/com/stylefeng/guns/config/web/ShiroConfig.java
View file @
f92d4358
...
...
@@ -24,7 +24,7 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.DependsOn
;
import
java.util.HashMap
;
import
java.util.
Linked
HashMap
;
import
java.util.Map
;
/**
...
...
@@ -145,7 +145,7 @@ public class ShiroConfig {
* user 验证通过或RememberMe登录的都可以
*
*/
Map
<
String
,
String
>
hashMap
=
new
HashMap
<>();
Map
<
String
,
String
>
hashMap
=
new
Linked
HashMap
<>();
hashMap
.
put
(
"/static/**"
,
"anon"
);
hashMap
.
put
(
"/login"
,
"anon"
);
hashMap
.
put
(
"/global/sessionError"
,
"anon"
);
...
...
src/main/java/com/stylefeng/guns/core/intercept/SessionTimeoutInterceptor.java
View file @
f92d4358
...
...
@@ -8,6 +8,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.stereotype.Component
;
/**
...
...
@@ -18,6 +19,7 @@ import org.springframework.stereotype.Component;
*/
@Aspect
@Component
@ConditionalOnProperty
(
prefix
=
"guns"
,
name
=
"session-open"
,
havingValue
=
"true"
)
public
class
SessionTimeoutInterceptor
extends
BaseController
{
@Pointcut
(
"execution(* com.stylefeng.guns.*..controller.*.*(..))"
)
...
...
src/main/java/com/stylefeng/guns/core/template/engine/base/GunsTemplateEngine.java
View file @
f92d4358
package
com
.
stylefeng
.
guns
.
core
.
template
.
engine
.
base
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.sun.javafx.PlatformUtil
;
import
org.beetl.core.Configuration
;
import
org.beetl.core.GroupTemplate
;
import
org.beetl.core.Template
;
...
...
@@ -53,7 +54,11 @@ public abstract class GunsTemplateEngine extends AbstractTemplateEngine {
public
void
generateFile
(
String
template
,
String
filePath
){
Template
pageTemplate
=
groupTemplate
.
getTemplate
(
template
);
configTemplate
(
pageTemplate
);
filePath
=
filePath
.
replaceAll
(
"\\\\"
,
File
.
separator
);
if
(
PlatformUtil
.
isLinux
()){
filePath
=
filePath
.
replaceAll
(
"/+|\\\\+"
,
"/"
);
}
else
{
filePath
=
filePath
.
replaceAll
(
"/+|\\\\+"
,
"\\\\"
);
}
File
file
=
new
File
(
filePath
);
File
parentFile
=
file
.
getParentFile
();
if
(!
parentFile
.
exists
()){
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/DeptController.java
View file @
f92d4358
...
...
@@ -158,7 +158,7 @@ public class DeptController extends BaseController {
}
private
void
deptSetPids
(
Dept
dept
)
{
if
(
ToolUtil
.
isEmpty
(
dept
.
getPid
())
||
dept
.
getPid
().
equals
(
"0"
))
{
if
(
ToolUtil
.
isEmpty
(
dept
.
getPid
())
||
dept
.
getPid
().
equals
(
0
))
{
dept
.
setPid
(
0
);
dept
.
setPids
(
"[0],"
);
}
else
{
...
...
src/main/resources/application.yml
View file @
f92d4358
...
...
@@ -6,7 +6,7 @@
guns
:
swagger-open
:
true
#是否开启swagger (true/false)
kaptcha-open
:
false
#是否开启登录时验证码 (true/false)
session-open
:
false
#是否开启session
验证
(true/false)
session-open
:
false
#是否开启session
超时验证(受影响的类SessionTimeoutInterceptor)
(true/false)
#file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录)
muti-datasource-open
:
false
#是否开启多数据源(true/false)
spring-session-open
:
false
#是否开启spring session,如果是多机环境需要开启(true/false)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment