Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
springboot_template
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project_template
springboot_template
Commits
eceea9ef
Commit
eceea9ef
authored
Jul 11, 2019
by
he
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init springboot template
parents
Pipeline
#44
failed with stages
Changes
12
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
398 additions
and
0 deletions
+398
-0
pom.xml
pom.xml
+60
-0
App.java
src/main/java/com/weface/App.java
+20
-0
TestController.java
src/main/java/com/weface/controller/TestController.java
+15
-0
Model.java
src/main/java/com/weface/dto/Model.java
+15
-0
GenerateMybatis.java
src/main/java/com/weface/utils/GenerateMybatis.java
+45
-0
application-dev.properties
src/main/resources/application-dev.properties
+31
-0
application-prod.properties
src/main/resources/application-prod.properties
+29
-0
application.properties
src/main/resources/application.properties
+17
-0
mybatis_generate.xml
src/main/resources/config/mybatis_generate.xml
+67
-0
log4j2_dev.xml
src/main/resources/log4j2_dev.xml
+35
-0
log4j2_prod.xml
src/main/resources/log4j2_prod.xml
+36
-0
AppTest.java
src/test/java/com/weface/AppTest.java
+28
-0
No files found.
pom.xml
0 → 100644
View file @
eceea9ef
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.weface
</groupId>
<artifactId>
springboot_template
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<name>
springboot_template
</name>
<!-- FIXME change it to the project's website -->
<url>
http://www.example.com
</url>
<distributionManagement>
<repository>
<id>
maven-releases
</id>
<name>
maven-releases
</name>
<url>
http://ops.weface.com.cn:8081/repository/maven-releases/
</url>
</repository>
<snapshotRepository>
<id>
maven-snapshots
</id>
<name>
maven-snapshots
</name>
<url>
http://ops.weface.com.cn:8081/repository/maven-snapshots/
</url>
</snapshotRepository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
</properties>
<parent>
<groupId>
com.weface
</groupId>
<artifactId>
springboot_base
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
</parent>
<dependencies>
<dependency>
<groupId>
com.weface
</groupId>
<artifactId>
springboot_base
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
<plugins>
<!--add this for docker-->
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
src/main/java/com/weface/App.java
0 → 100644
View file @
eceea9ef
package
com
.
weface
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
/**
*
*/
@SpringBootApplication
@ComponentScan
(
"com.weface"
)
@MapperScan
(
"com.weface.dao"
)
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
App
.
class
,
args
);
}
}
src/main/java/com/weface/controller/TestController.java
0 → 100644
View file @
eceea9ef
package
com
.
weface
.
controller
;
import
com.weface.dto.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
public
class
TestController
{
@RequestMapping
(
"/hello/world"
)
public
Model
test
(){
return
new
Model
().
setState
(
200
).
setDescribe
(
"操作成功"
);
}
}
src/main/java/com/weface/dto/Model.java
0 → 100644
View file @
eceea9ef
package
com
.
weface
.
dto
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
@Data
@Accessors
(
chain
=
true
)
public
class
Model
<
T
>
{
private
Integer
state
;
private
String
describe
;
private
T
result
;
}
src/main/java/com/weface/utils/GenerateMybatis.java
0 → 100755
View file @
eceea9ef
package
com
.
weface
.
utils
;
import
org.mybatis.generator.api.MyBatisGenerator
;
import
org.mybatis.generator.config.Configuration
;
import
org.mybatis.generator.config.xml.ConfigurationParser
;
import
org.mybatis.generator.internal.DefaultShellCallback
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
/*************************************************************************
* 注意:逆向工程生成的jar包,是在src下的目录下
* @author admin
* 每次运行完毕过后 要刷新一下,就会找到你要的文件 src下
*******************************************************************************/
public
class
GenerateMybatis
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
try
{
GenerateMybatis
generatorSqlmap
=
new
GenerateMybatis
();
generatorSqlmap
.
generator
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
void
generator
()
throws
Exception
{
List
<
String
>
warnings
=
new
ArrayList
<
String
>();
boolean
overwrite
=
true
;
//指定 逆向工程配置文件
InputStream
configFile
=
Thread
.
currentThread
().
getContextClassLoader
().
getResourceAsStream
(
"config/mybatis_generate.xml"
);
ConfigurationParser
cp
=
new
ConfigurationParser
(
warnings
);
Configuration
config
=
cp
.
parseConfiguration
(
configFile
);
DefaultShellCallback
callback
=
new
DefaultShellCallback
(
overwrite
);
MyBatisGenerator
myBatisGenerator
=
new
MyBatisGenerator
(
config
,
callback
,
warnings
);
myBatisGenerator
.
generate
(
null
);
}
}
src/main/resources/application-dev.properties
0 → 100644
View file @
eceea9ef
# 设置发布的端口
server.port
:
8081
# 设置项目的访问路径
server.servlet.context-path
=
/
logging.config
=
classpath:log4j2_dev.xml
#mybatis mapper文件的路径
mybatis.mapperLocations
=
classpath*:sql/*.xml
#数据库配置
spring.datasource.url
=
jdbc:mysql://172.16.10.206:3306/socialsecurity_beta?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
spring.datasource.username
=
javamysql
spring.datasource.password
=
weface1101
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
spring.datasource.druid.initial-size
=
2
spring.datasource.druid.min-idle
=
2
spring.datasource.druid.max-active
=
10
spring.datasource.tomcat.max-wait
=
50000
spring.datasource.tomcat.time-between-eviction-runs-millis
=
5000
spring.datasource.druid.min-evictable-idle-time-millis
=
200000
spring.datasource.druid.validation-query
=
SELECT 1 FROM DUAL
spring.datasource.druid.test-while-idle
=
true
spring.datasource.druid.test-on-borrow
=
false
spring.datasource.druid.test-on-return
=
false
spring.datasource.druid.pool-prepared-statements
=
true
spring.datasource.druid.filters
=
stat,wall,log4j
spring.datasource.druid.connection-properties
=
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
src/main/resources/application-prod.properties
0 → 100644
View file @
eceea9ef
# 设置发布的端口
server.port
:
8181
# 设置项目的访问路径
server.servlet.context-path
=
/
logging.config
=
classpath:log4j2_prod.xml
#mybatis mapper文件的路径
mybatis.mapperLocations
=
classpath*:sql/*.xml
#数据库配置
spring.datasource.url
=
spring.datasource.username
=
spring.datasource.password
=
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
spring.datasource.druid.initial-size
=
2
spring.datasource.druid.min-idle
=
2
spring.datasource.druid.max-active
=
500
spring.datasource.tomcat.max-wait
=
50000
spring.datasource.tomcat.time-between-eviction-runs-millis
=
5000
spring.datasource.druid.min-evictable-idle-time-millis
=
200000
spring.datasource.druid.validation-query
=
SELECT 1 FROM DUAL
spring.datasource.druid.test-while-idle
=
true
spring.datasource.druid.test-on-borrow
=
false
spring.datasource.druid.test-on-return
=
false
spring.datasource.druid.pool-prepared-statements
=
true
spring.datasource.druid.filters
=
stat,wall,log4j
spring.datasource.druid.connection-properties
=
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
src/main/resources/application.properties
0 → 100644
View file @
eceea9ef
spring.profiles.active
=
dev
# 设置项目编码方式
server.tomcat.uri-encoding
=
UTF-8
spring.http.encoding.charset
=
UTF-8
spring.http.encoding.enabled
=
true
spring.http.encoding.force
=
true
spring.messages.encoding
=
UTF-8
#Spring 会自动读取资源md5,然后添加到index.css的名字后面,因此当资源内容发生变化的时候,文件名发生变化,就会更新本地资源 WebMvcConfigurerAdapter
spring.resources.chain.strategy.content.enabled
=
true
spring.resources.chain.strategy.content.paths
=
/**
src/main/resources/config/mybatis_generate.xml
0 → 100644
View file @
eceea9ef
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!--<properties resource="jdbc.properties" />-->
<context
id=
"sqlserverTables"
targetRuntime=
"MyBatis3"
>
<!-- 生成的pojo,将implements Serializable-->
<plugin
type=
"org.mybatis.generator.plugins.SerializablePlugin"
></plugin>
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property
name=
"suppressAllComments"
value=
"true"
/>
</commentGenerator>
<!-- TODO 数据库链接URL、用户名、密码 -->
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
connectionURL=
""
userId=
""
password=
""
>
</jdbcConnection>
<!--
默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer
true,把JDBC DECIMAL 和 NUMERIC 类型解析为java.math.BigDecimal
-->
<javaTypeResolver>
<property
name=
"forceBigDecimals"
value=
"false"
/>
</javaTypeResolver>
<!--
生成model模型,对应的包路径,以及文件存放路径(targetProject),targetProject可以指定具体的路径,如./src/main/java,
也可以使用“MAVEN”来自动生成,这样生成的代码会在target/generatord-source目录下
-->
<!--<javaModelGenerator targetPackage="com.joey.mybaties.test.pojo" targetProject="MAVEN">-->
<javaModelGenerator
targetPackage=
"com.weface.entity"
targetProject=
"./src/main/java"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
<!-- 从数据库返回的值被清理前后的空格 -->
<property
name=
"trimStrings"
value=
"true"
/>
</javaModelGenerator>
<!--对应的mapper.xml文件 -->
<sqlMapGenerator
targetPackage=
"com.weface.dao.sql"
targetProject=
"./src/main/java"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
</sqlMapGenerator>
<!-- 对应的Mapper接口类文件 -->
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.weface.dao"
targetProject=
"./src/main/java"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
</javaClientGenerator>
<!-- 列出要生成代码的所有表,这里配置的是不生成Example文件 -->
<table
tableName=
"x_import_user"
domainObjectName=
"ImportUser"
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
selectByExampleQueryId=
"false"
>
<!--实体类和数据库字段名不一致,false不一至,true一致-->
<property
name=
"useActualColumnNames"
value=
"true"
/>
</table>
</context>
</generatorConfiguration>
src/main/resources/log4j2_dev.xml
0 → 100644
View file @
eceea9ef
<?xml version="1.0" encoding="UTF-8"?>
<Configuration
status=
"warn"
monitorInterval=
"30"
>
<Properties>
<Property
name=
"appName"
>
../appLogs
</Property>
</Properties>
<Appenders>
<!--这个输出控制台的配置-->
<Console
name=
"Console"
target=
"SYSTEM_OUT"
>
<ThresholdFilter
level=
"trace"
onMatch=
"ACCEPT"
onMismatch=
"DENY"
/>
<PatternLayout
pattern=
"%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"
>
</PatternLayout>
</Console>
<!--输出到文件 RollingFileManager-->
<RollingFile
name=
"RollingFile"
fileName=
"${appName}/app.log"
append=
"false"
immediateFlush=
"true"
filePattern=
"${appName}/app-%d{MM-dd-yyyy}-%i.log.gz"
>
<PatternLayout
pattern=
"%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"
></PatternLayout>
<Policies>
<OnStartupTriggeringPolicy
/>
<SizeBasedTriggeringPolicy
size=
"20 MB"
/>
<TimeBasedTriggeringPolicy
/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<AsyncLogger
name=
"com.weface"
level=
"debug"
includeLocation=
"true"
additivity=
"false"
>
<AppenderRef
ref=
"Console"
/>
</AsyncLogger>
<AsyncLogger
name =
"org.springframework.web.servlet"
level=
"trace"
includeLocation=
"true"
additivity=
"false"
>
<AppenderRef
ref=
"Console"
/>
</AsyncLogger>
<AsyncRoot
level=
"info"
includeLocation=
"true"
additivity=
"false"
>
<AppenderRef
ref=
"Console"
/>
</AsyncRoot>
</Loggers>
</Configuration>
src/main/resources/log4j2_prod.xml
0 → 100644
View file @
eceea9ef
<?xml version="1.0" encoding="UTF-8"?>
<Configuration
status=
"warn"
monitorInterval=
"30"
>
<Properties>
<Property
name=
"appName"
>
../appLogs
</Property>
</Properties>
<Appenders>
<!--这个输出控制台的配置-->
<Console
name=
"Console"
target=
"SYSTEM_OUT"
>
<ThresholdFilter
level=
"trace"
onMatch=
"ACCEPT"
onMismatch=
"DENY"
/>
<PatternLayout
pattern=
"%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"
>
</PatternLayout>
</Console>
<!--输出到文件 RollingFileManager-->
<RollingFile
name=
"RollingFile"
fileName=
"${appName}/app.log"
append=
"false"
immediateFlush=
"true"
filePattern=
"${appName}/app-%d{MM-dd-yyyy}-%i.log.gz"
>
<PatternLayout
pattern=
"%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"
></PatternLayout>
<Policies>
<OnStartupTriggeringPolicy
/>
<SizeBasedTriggeringPolicy
size=
"20 MB"
/>
<TimeBasedTriggeringPolicy
/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<AsyncLogger
name=
"com.weface"
level=
"debug"
includeLocation=
"true"
additivity=
"false"
>
<AppenderRef
ref=
"Console"
/>
</AsyncLogger>
<AsyncLogger
name =
"org.springframework.web.servlet.handler"
level=
"trace"
includeLocation=
"true"
additivity=
"false"
>
<AppenderRef
ref=
"Console"
/>
</AsyncLogger>
<AsyncRoot
level=
"info"
includeLocation=
"true"
additivity=
"false"
>
<AppenderRef
ref=
"RollingFile"
/>
<AppenderRef
ref=
"Console"
/>
</AsyncRoot>
</Loggers>
</Configuration>
src/test/java/com/weface/AppTest.java
0 → 100644
View file @
eceea9ef
package
com
.
weface
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
com.weface.uttils.HeUtils
;
import
com.weface.uttils.MimaUtils
;
import
org.junit.Test
;
/**
* Unit test for simple App.
*/
public
class
AppTest
{
/**
* Rigorous Test :-)
*/
@Test
public
void
shouldAnswerWithTrue
()
{
assertTrue
(
true
);
}
@Test
public
void
test1
(){
String
result
=
MimaUtils
.
md5Encrypt
(
"hehuijun"
);
System
.
out
.
println
(
result
);
}
}
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