Skip to content

Commit f555cb3

Browse files
committed
添加springboot-shiro
1 parent 2cf3ac8 commit f555cb3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+11584
-1
lines changed

app-manage/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ mvn install:install-file -Dfile=AXMLPrinter-1.0.jar -DgroupId=com.xncoding -Dart
5555

5656
## 测试账号
5757

58-
1. admin/123456
58+
1. admin/12345678
5959
2. test/12345678
6060

6161
## 许可证

springboot-shiro/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# 此为注释– 将被Git 忽略
2+
# /结尾表示是目录,忽略目录和目录下的所有件
3+
# /开头表示根目录,否则是.gitignore的相对目录
4+
# !开头表示反选
5+
.idea/
6+
target/
7+
*.iml
8+
*.ipr
9+
*.iws
10+
*.log
11+
.svn/
12+
.project
13+
rebel.xml
14+
.rebel-remote.xml.*

springboot-shiro/LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018 Xiong Neng
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

springboot-shiro/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## 集成Shiro权限管理
2+
3+
SpringBoot和Shiro集成,实现用户登录认证和授权访问页面。
4+
5+
## 数据库初始化
6+
7+
执行SQL文件`src/main/resources/sql/schema.sql`
8+
9+
## 测试账号
10+
11+
1. admin/12345678
12+
2. aix/12345678
13+
14+
## 许可证
15+
16+
Copyright (c) 2018 Xiong Neng
17+
18+
基于 MIT 协议发布: <http://www.opensource.org/licenses/MIT>

springboot-shiro/pom.xml

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.xncoding</groupId>
8+
<artifactId>springboot-shiro</artifactId>
9+
<version>1.0.0-SNAPSHOT</version>
10+
<packaging>jar</packaging>
11+
12+
<name>springboot-shiro</name>
13+
<description>集成Shiro权限管理</description>
14+
15+
<parent>
16+
<groupId>org.springframework.boot</groupId>
17+
<artifactId>spring-boot-starter-parent</artifactId>
18+
<version>1.5.9.RELEASE</version>
19+
<relativePath/>
20+
</parent>
21+
22+
<properties>
23+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
24+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
25+
<java.version>1.8</java.version>
26+
<druid.version>1.1.2</druid.version>
27+
<mysql-connector.version>8.0.7-dmr</mysql-connector.version>
28+
<mybatis-plus.version>2.1.8</mybatis-plus.version>
29+
<mybatisplus-spring-boot-starter.version>1.0.5</mybatisplus-spring-boot-starter.version>
30+
<!--以下两项需要如果不配置,解析themleaft 会有问题-->
31+
<thymeleaf.version>3.0.7.RELEASE</thymeleaf.version>
32+
<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
33+
</properties>
34+
35+
<dependencies>
36+
<dependency>
37+
<groupId>org.springframework.boot</groupId>
38+
<artifactId>spring-boot-starter-web</artifactId>
39+
<exclusions>
40+
<exclusion>
41+
<groupId>org.springframework.boot</groupId>
42+
<artifactId>spring-boot-starter-tomcat</artifactId>
43+
</exclusion>
44+
</exclusions>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.springframework.boot</groupId>
48+
<artifactId>spring-boot-starter-jetty</artifactId>
49+
</dependency>
50+
<dependency>
51+
<groupId>org.springframework.boot</groupId>
52+
<artifactId>spring-boot-starter-jdbc</artifactId>
53+
</dependency>
54+
<dependency>
55+
<groupId>mysql</groupId>
56+
<artifactId>mysql-connector-java</artifactId>
57+
<version>${mysql-connector.version}</version>
58+
<scope>runtime</scope>
59+
</dependency>
60+
<dependency>
61+
<groupId>com.alibaba</groupId>
62+
<artifactId>druid</artifactId>
63+
<version>${druid.version}</version>
64+
</dependency>
65+
<!-- MyBatis plus增强和springboot的集成-->
66+
<dependency>
67+
<groupId>com.baomidou</groupId>
68+
<artifactId>mybatis-plus</artifactId>
69+
<version>${mybatis-plus.version}</version>
70+
</dependency>
71+
<dependency>
72+
<groupId>com.baomidou</groupId>
73+
<artifactId>mybatisplus-spring-boot-starter</artifactId>
74+
<version>${mybatisplus-spring-boot-starter.version}</version>
75+
</dependency>
76+
77+
<dependency>
78+
<groupId>org.springframework.boot</groupId>
79+
<artifactId>spring-boot-starter-test</artifactId>
80+
<scope>test</scope>
81+
</dependency>
82+
<dependency>
83+
<groupId>commons-io</groupId>
84+
<artifactId>commons-io</artifactId>
85+
<version>2.5</version>
86+
</dependency>
87+
<dependency>
88+
<groupId>org.apache.commons</groupId>
89+
<artifactId>commons-lang3</artifactId>
90+
<version>3.7</version>
91+
</dependency>
92+
<dependency>
93+
<groupId>commons-codec</groupId>
94+
<artifactId>commons-codec</artifactId>
95+
<version>1.11</version>
96+
</dependency>
97+
<dependency>
98+
<groupId>org.springframework.boot</groupId>
99+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
100+
</dependency>
101+
<!-- thymeleaf模板中shiro标签-->
102+
<dependency>
103+
<groupId>com.github.theborakompanioni</groupId>
104+
<artifactId>thymeleaf-extras-shiro</artifactId>
105+
<version>2.0.0</version>
106+
</dependency>
107+
<!-- shiro 权限控制 -->
108+
<dependency>
109+
<groupId>org.apache.shiro</groupId>
110+
<artifactId>shiro-spring</artifactId>
111+
<version>1.4.0</version>
112+
<exclusions>
113+
<exclusion>
114+
<artifactId>slf4j-api</artifactId>
115+
<groupId>org.slf4j</groupId>
116+
</exclusion>
117+
</exclusions>
118+
</dependency>
119+
<!-- shiro ehcache (shiro缓存)-->
120+
<dependency>
121+
<groupId>org.apache.shiro</groupId>
122+
<artifactId>shiro-ehcache</artifactId>
123+
<version>1.4.0</version>
124+
<exclusions>
125+
<exclusion>
126+
<artifactId>slf4j-api</artifactId>
127+
<groupId>org.slf4j</groupId>
128+
</exclusion>
129+
</exclusions>
130+
</dependency>
131+
<!--验证码框架-->
132+
<dependency>
133+
<groupId>com.github.axet</groupId>
134+
<artifactId>kaptcha</artifactId>
135+
<version>0.0.9</version>
136+
</dependency>
137+
138+
</dependencies>
139+
140+
<build>
141+
<plugins>
142+
<plugin>
143+
<groupId>org.apache.maven.plugins</groupId>
144+
<artifactId>maven-compiler-plugin</artifactId>
145+
<version>3.6.1</version>
146+
<configuration>
147+
<!--<proc>none</proc>-->
148+
<source>1.8</source>
149+
<target>1.8</target>
150+
</configuration>
151+
</plugin>
152+
<plugin>
153+
<groupId>org.apache.maven.plugins</groupId>
154+
<artifactId>maven-surefire-plugin</artifactId>
155+
<version>2.20</version>
156+
<configuration>
157+
<skip>true</skip>
158+
</configuration>
159+
</plugin>
160+
<plugin>
161+
<groupId>org.springframework.boot</groupId>
162+
<artifactId>spring-boot-maven-plugin</artifactId>
163+
<executions>
164+
</executions>
165+
</plugin>
166+
</plugins>
167+
168+
<resources>
169+
<resource>
170+
<directory>src/main/resources</directory>
171+
</resource>
172+
<resource>
173+
<directory>src/main/java</directory>
174+
<includes>
175+
<include>**/*.xml</include>
176+
</includes>
177+
</resource>
178+
</resources>
179+
</build>
180+
181+
</project>

springboot-shiro/run.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
# 项目自动更新脚本
3+
# 先clone相应的分支下来:
4+
# git clone ssh://[email protected]:7999/xxx.git
5+
# 远程调试启动:
6+
# nohup java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -Xms512m -Xmx1024m -jar -Dspring.profiles.active=${profile} ${jarfile} >/dev/null 2>&1 &
7+
8+
function start {
9+
profile="$1"
10+
echo "启动环境profile=${profile}"
11+
jarfile=$(ls target/*.jar)
12+
if [[ "$?" == "0" ]]; then
13+
stop $profile $jarfile
14+
fi
15+
branch=$(git branch |awk '{print $2}')
16+
git pull origin ${branch}
17+
echo "更新完代码开始重新打包"
18+
mvn clean && mvn clean && mvn package -DskipTests=true
19+
if [[ "$?" != "0" ]]; then
20+
echo "编译出错,退出!"
21+
exit 1
22+
fi
23+
echo "nohup java -Xms512m -Xmx1024m -jar -Dspring.profiles.active=${profile} ${jarfile} >/dev/null 2>&1 &"
24+
nohup java -Xms512m -Xmx1024m -jar -Dspring.profiles.active=${profile} ${jarfile} >/dev/null 2>&1 &
25+
echo "启动应用中,请查看日志文件..."
26+
}
27+
28+
function stop {
29+
profile="$1"
30+
jarfile="$2"
31+
ps aux | grep "${jarfile}" | grep "spring.profiles.active=${profile}" | grep -v grep > /dev/null
32+
if [[ "$?" == "0" ]]; then
33+
echo "该应用还在跑,我先停了它"
34+
pid=$(ps aux | grep "${jarfile}" | grep "spring.profiles.active=${profile}" | grep -v grep |awk '{print $2}')
35+
if [[ "$pid" != "" ]]; then
36+
kill -9 $pid
37+
fi
38+
echo "停止应用成功..."
39+
fi
40+
}
41+
42+
if [[ "$1" == "start" ]]; then
43+
if [[ "$#" < 2 ]]; then
44+
echo "请输入正确参数:./epay.sh start {profile}"
45+
exit 1
46+
fi
47+
profile="$2"
48+
if [[ "$profile" != "dev" && "$profile" != "test" && "$profile" != "show" && "$profile" != "production" ]]; then
49+
echo "参数错误,请输入正确的profile参数,使用方法:"
50+
echo "./epay.sh start {profile} ==> 启动应用,{profile}取值:dev|test|show|production"
51+
exit 1
52+
fi
53+
start "${profile}"
54+
elif [[ "$1" == "stop" ]]; then
55+
if [[ "$#" < 2 ]]; then
56+
echo "请输入正确参数:./epay.sh stop {profile}"
57+
exit 1
58+
fi
59+
profile="$2"
60+
if [[ "$profile" != "dev" && "$profile" != "test" && "$profile" != "show" && "$profile" != "production" ]]; then
61+
echo "参数错误,请输入正确的profile参数,使用方法:"
62+
echo "./epay.sh stop {profile} ==> 停止应用,{profile}取值:dev|test|show|production"
63+
exit 1
64+
fi
65+
jarfile=$(ls target/*.jar)
66+
stop $profile $jarfile
67+
else
68+
echo "参数错误,使用方法:{}参数是必填的,[]参数可选"
69+
echo "./epay.sh start {profile} ==> 启动应用,{profile}取值:dev|test|show|production"
70+
echo "./epay.sh stop {profile} ==> 停止应用,{profile}取值:dev|test|show|production"
71+
exit 1
72+
fi
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.xncoding.pos;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class Application {
8+
public static void main(String[] args) {
9+
SpringApplication.run(Application.class, args);
10+
}
11+
12+
}

0 commit comments

Comments
 (0)