Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
武汉红喜
whatsmars
提交
76500cf1
W
whatsmars
项目概览
武汉红喜
/
whatsmars
通知
3
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
whatsmars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
76500cf1
编写于
6月 20, 2017
作者:
S
shenhongxi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
springboot
上级
84498157
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
208 addition
and
152 deletion
+208
-152
whatsmars-spring-boot/README.md
whatsmars-spring-boot/README.md
+1
-0
whatsmars-spring-boot/pom.xml
whatsmars-spring-boot/pom.xml
+28
-0
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/Application.java
...in/java/com/itlong/whatsmars/spring/boot/Application.java
+15
-0
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/DataSourceConfig.java
...va/com/itlong/whatsmars/spring/boot/DataSourceConfig.java
+0
-46
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/MapperScanner.java
.../java/com/itlong/whatsmars/spring/boot/MapperScanner.java
+0
-24
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/MybatisConfig.java
.../java/com/itlong/whatsmars/spring/boot/MybatisConfig.java
+0
-48
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/SampleController.java
...va/com/itlong/whatsmars/spring/boot/SampleController.java
+0
-4
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/TestDao.java
...c/main/java/com/itlong/whatsmars/spring/boot/TestDao.java
+0
-22
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/UserConfig.java
...ain/java/com/itlong/whatsmars/spring/boot/UserConfig.java
+21
-0
whatsmars-spring-boot/src/main/resources/application-test.properties
...pring-boot/src/main/resources/application-test.properties
+62
-0
whatsmars-spring-boot/src/main/resources/application.properties
...ars-spring-boot/src/main/resources/application.properties
+5
-0
whatsmars-spring-boot/src/main/resources/mapper/User-mapper.xml
...ars-spring-boot/src/main/resources/mapper/User-mapper.xml
+6
-0
whatsmars-spring-boot/src/main/resources/mybatis-config.xml
whatsmars-spring-boot/src/main/resources/mybatis-config.xml
+69
-0
whatsmars-spring-boot/src/main/resources/prop.properties
whatsmars-spring-boot/src/main/resources/prop.properties
+0
-8
whatsmars-spring-boot/src/main/resources/user.properties
whatsmars-spring-boot/src/main/resources/user.properties
+1
-0
未找到文件。
whatsmars-spring-boot/README.md
0 → 100644
浏览文件 @
76500cf1
启动后访问 http://localhost/user/
\ No newline at end of file
whatsmars-spring-boot/pom.xml
浏览文件 @
76500cf1
...
@@ -36,6 +36,34 @@
...
@@ -36,6 +36,34 @@
<artifactId>
commons-dbcp
</artifactId>
<artifactId>
commons-dbcp
</artifactId>
<version>
1.4
</version>
<version>
1.4
</version>
</dependency>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper
</artifactId>
<version>
4.1.6
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-log4j2
</artifactId>
</dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
<version>
1.1.1
</version>
<exclusions>
<exclusion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-logging
</artifactId>
</exclusion>
<exclusion>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-classic
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/Application.java
0 → 100644
浏览文件 @
76500cf1
package
com.itlong.whatsmars.spring.boot
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
@SpringBootApplication
@EnableConfigurationProperties
({
UserConfig
.
class
})
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
}
}
\ No newline at end of file
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/DataSourceConfig.java
已删除
100644 → 0
浏览文件 @
84498157
package
com.itlong.whatsmars.spring.boot
;
import
org.apache.commons.dbcp.BasicDataSource
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.PropertySource
;
/**
* Created by Administrator on 2017/3/27.
*/
@Configuration
//这个注解导入刚才增加的jdbc配置文件
@PropertySource
(
"classpath:prop.properties"
)
public
class
DataSourceConfig
{
@Value
(
"${jdbc.driver}"
)
private
String
driver
;
@Value
(
"${jdbc.url}"
)
private
String
url
;
@Value
(
"${jdbc.username}"
)
private
String
username
;
@Value
(
"${jdbc.password}"
)
private
String
password
;
@Value
(
"${jdbc.maxActive}"
)
private
int
maxActive
;
@Value
(
"${jdbc.maxIdel}"
)
private
int
maxIdel
;
@Value
(
"${jdbc.maxWait}"
)
private
long
maxWait
;
@Bean
public
BasicDataSource
dataSource
(){
BasicDataSource
dataSource
=
new
BasicDataSource
();
dataSource
.
setDriverClassName
(
driver
);
dataSource
.
setUrl
(
url
);
dataSource
.
setUsername
(
username
);
dataSource
.
setPassword
(
password
);
dataSource
.
setMaxActive
(
maxActive
);
dataSource
.
setMaxIdle
(
maxIdel
);
dataSource
.
setMaxWait
(
maxWait
);
dataSource
.
setValidationQuery
(
"SELECT 1"
);
dataSource
.
setTestOnBorrow
(
true
);
return
dataSource
;
}
}
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/MapperScanner.java
已删除
100644 → 0
浏览文件 @
84498157
package
com.itlong.whatsmars.spring.boot
;
import
org.mybatis.spring.mapper.MapperScannerConfigurer
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* Created by Administrator on 2017/3/27.
*/
@Configuration
// 因为这个对象的扫描,需要在MyBatisConfig的后面注入,所以加上下面的注解
@AutoConfigureAfter
(
MybatisConfig
.
class
)
public
class
MapperScanner
{
@Bean
public
MapperScannerConfigurer
mapperScannerConfigurer
()
{
MapperScannerConfigurer
mapperScannerConfigurer
=
new
MapperScannerConfigurer
();
//获取之前注入的beanName为sqlSessionFactory的对象
mapperScannerConfigurer
.
setSqlSessionFactoryBeanName
(
"sqlSessionFactory"
);
//指定xml配置文件的路径
mapperScannerConfigurer
.
setBasePackage
(
"com.framework.msg.mapper"
);
return
mapperScannerConfigurer
;
}
}
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/MybatisConfig.java
已删除
100644 → 0
浏览文件 @
84498157
package
com.itlong.whatsmars.spring.boot
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.mybatis.spring.SqlSessionFactoryBean
;
import
org.mybatis.spring.SqlSessionTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.transaction.PlatformTransactionManager
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.TransactionManagementConfigurer
;
import
javax.sql.DataSource
;
/**
* Created by Administrator on 2017/3/27.
*/
@Configuration
//加上这个注解,使得支持事务
@EnableTransactionManagement
public
class
MybatisConfig
implements
TransactionManagementConfigurer
{
@Autowired
private
DataSource
dataSource
;
@Override
public
PlatformTransactionManager
annotationDrivenTransactionManager
()
{
return
new
DataSourceTransactionManager
(
dataSource
);
}
@Bean
(
name
=
"sqlSessionFactory"
)
public
SqlSessionFactory
sqlSessionFactoryBean
()
{
SqlSessionFactoryBean
bean
=
new
SqlSessionFactoryBean
();
bean
.
setDataSource
(
dataSource
);
try
{
return
bean
.
getObject
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
e
);
}
}
@Bean
public
SqlSessionTemplate
sqlSessionTemplate
(
SqlSessionFactory
sqlSessionFactory
)
{
return
new
SqlSessionTemplate
(
sqlSessionFactory
);
}
}
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/SampleController.java
浏览文件 @
76500cf1
package
com.itlong.whatsmars.spring.boot
;
package
com.itlong.whatsmars.spring.boot
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -19,7 +18,4 @@ public class SampleController {
...
@@ -19,7 +18,4 @@ public class SampleController {
return
"Hello World!"
;
return
"Hello World!"
;
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SpringApplication
.
run
(
SampleController
.
class
,
args
);
}
}
}
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/TestDao.java
已删除
100644 → 0
浏览文件 @
84498157
package
com.itlong.whatsmars.spring.boot
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.Map
;
/**
* Created by Administrator on 2017/3/27.
*/
@Mapper
public
interface
TestDao
{
@Select
(
"select * from wx_userinfo;"
)
public
Map
<
String
,
Object
>
find
();
@Insert
(
"insert into wx_userinfo(openid,status,nickname,sex,city,province,country,headimgurl,subscribe_time) "
+
"values(#{id},1,'nick',1,'city','provi','contr','img',now())"
)
public
int
insert
(
@Param
(
"id"
)
int
id
);
}
whatsmars-spring-boot/src/main/java/com/itlong/whatsmars/spring/boot/UserConfig.java
0 → 100644
浏览文件 @
76500cf1
package
com.itlong.whatsmars.spring.boot
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
java.util.List
;
/**
* Created by shenhongxi on 2017/6/20.
*/
@ConfigurationProperties
(
prefix
=
"whatsmars"
)
public
class
UserConfig
{
private
List
<
String
>
noFilterUrl
;
public
List
<
String
>
getNoFilterUrl
()
{
return
noFilterUrl
;
}
public
void
setNoFilterUrl
(
List
<
String
>
noFilterUrl
)
{
this
.
noFilterUrl
=
noFilterUrl
;
}
}
whatsmars-spring-boot/src/main/resources/application-test.properties
0 → 100644
浏览文件 @
76500cf1
server.port
:
80
spring.session.store-type
=
redis
server.session.timeout
=
14400
# TODO: unavailable for redis
#server.session.cookie.domain=${toutiao.domain}
#server.session.cookie.http-only=true
#server.session.cookie.path=/
#management.port: 9900
#management.address: 127.0.0.1
server.contextPath
=
/user
server.tomcat.uri-encoding
=
UTF-8
server.tomcat.basedir
=
/data/wely/logs
server.tomcat.accesslog.directory
=
logs
server.tomcat.accesslog.enabled
=
true
server.tomcat.accesslog.pattern
=
common
server.tomcat.accesslog.prefix
=
access_log
server.tomcat.accesslog.suffix
=
.log
spring.datasource.url
=
jdbc:mysql://127.0.0.1:3306/wely?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
spring.datasource.username
=
root
spring.datasource.password
=
123456
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
spring.datasource.tomcat.min-idle
=
10
spring.datasource.tomcat.max-idle
=
50
spring.datasource.tomcat.max-active
=
100
spring.datasource.tomcat.max-wait
=
10000
spring.datasource.tomcat.max-age
=
10000
spring.datasource.tomcat.test-on-borrow
=
true
spring.datasource.tomcat.test-on-return
=
false
spring.datasource.tomcat.test-while-idle
=
true
spring.datasource.tomcat.time-between-eviction-runs-millis
=
5000
spring.datasource.tomcat.validation-query
=
SELECT 1
mybatis.config-location
=
classpath:mybatis-config.xml
# REDIS (RedisProperties)
spring.redis.host
=
127.0.0.1
spring.redis.password
=
123456
spring.redis.pool.max-active
=
8
spring.redis.pool.max-idle
=
8
spring.redis.pool.max-wait
=
-1
spring.redis.pool.min-idle
=
1
spring.redis.port
=
6379
spring.redis.timeout
=
0
spring.jackson.date-format
=
yyyy-MM-dd HH:mm:ss
toutiao.domain
=
www.toutiao.im
toutiao.loginCallback
=
http://${toutiao.domain}/user/login
toutiao.logoutCallback
=
http://${toutiao.domain}/
toutiao.loginSuccessIndex
=
http://${toutiao.domain}/index.html
#open api auth
openapi.auth.enable
=
true
whatsmars-spring-boot/src/main/resources/application.properties
0 → 100644
浏览文件 @
76500cf1
#spring.profiles.active=prod
#spring.profiles.active=dev
spring.profiles.active
=
test
\ No newline at end of file
whatsmars-spring-boot/src/main/resources/mapper/User-mapper.xml
0 → 100644
浏览文件 @
76500cf1
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"LenderAccountMapper"
>
</mapper>
\ No newline at end of file
whatsmars-spring-boot/src/main/resources/mybatis-config.xml
0 → 100644
浏览文件 @
76500cf1
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright ${license.git.copyrightYears} the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting
name=
"logImpl"
value=
"LOG4J2"
/>
<setting
name=
"callSettersOnNulls"
value=
"true"
/>
<setting
name=
"mapUnderscoreToCamelCase"
value=
"true"
/>
</settings>
<typeAliases>
<package
name=
"com.itlong.whatsmars.*.model"
/>
</typeAliases>
<plugins>
<!-- com.github.pagehelper为PageHelper类所在包名 -->
<plugin
interceptor=
"com.github.pagehelper.PageHelper"
>
<!-- 4.0.0以后版本可以不设置该参数 -->
<property
name=
"dialect"
value=
"mysql"
/>
<!-- 该参数默认为false -->
<!-- 设置为true时,会将RowBounds第一个参数offset当成pageNum页码使用 -->
<!-- 和startPage中的pageNum效果一样-->
<property
name=
"offsetAsPageNum"
value=
"true"
/>
<!-- 该参数默认为false -->
<!-- 设置为true时,使用RowBounds分页会进行count查询 -->
<property
name=
"rowBoundsWithCount"
value=
"true"
/>
<!-- 设置为true时,如果pageSize=0或者RowBounds.limit = 0就会查询出全部的结果 -->
<!-- (相当于没有执行分页查询,但是返回结果仍然是Page类型)-->
<property
name=
"pageSizeZero"
value=
"true"
/>
<!-- 3.3.0版本可用 - 分页参数合理化,默认false禁用 -->
<!-- 启用合理化时,如果pageNum<1会查询第一页,如果pageNum>pages会查询最后一页 -->
<!-- 禁用合理化时,如果pageNum<1或pageNum>pages会返回空数据 -->
<property
name=
"reasonable"
value=
"false"
/>
<!-- 3.5.0版本可用 - 为了支持startPage(Object params)方法 -->
<!-- 增加了一个`params`参数来配置参数映射,用于从Map或ServletRequest中取值 -->
<!-- 可以配置pageNum,pageSize,count,pageSizeZero,reasonable,orderBy,不配置映射的用默认值 -->
<!-- 不理解该含义的前提下,不要随便复制该配置 -->
<!--<property name="params" value="pageNum=pageHelperStart;pageSize=pageHelperRows;"/>-->
<!-- 支持通过Mapper接口参数来传递分页参数 -->
<property
name=
"supportMethodsArguments"
value=
"false"
/>
<!-- always总是返回PageInfo类型,check检查返回类型是否为PageInfo,none返回Page -->
<property
name=
"returnPageInfo"
value=
"none"
/>
</plugin>
</plugins>
<mappers>
<mapper
resource=
"mapper/User-mapper.xml"
/>
</mappers>
</configuration>
whatsmars-spring-boot/src/main/resources/prop.properties
已删除
100644 → 0
浏览文件 @
84498157
#jdbc
jdbc.driver
=
com.mysql.jdbc.Driver
jdbc.url
=
jdbc:mysql://192.168.137.2:3306/weichat?useUnicode=true&characterEncoding=utf8
jdbc.username
=
root
jdbc.password
=
123456
jdbc.maxActive
=
2335
jdbc.maxIdel
=
120
jdbc.maxWait
=
100
\ No newline at end of file
whatsmars-spring-boot/src/main/resources/user.properties
0 → 100644
浏览文件 @
76500cf1
whatsmars.noFilterUrl
=
/,/login
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录