Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bigsys
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
bigsys
Commits
a45c842d
You need to sign in or sign up before continuing.
Commit
a45c842d
authored
Aug 30, 2017
by
fangzhipeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置数据库连接
parent
8cf6af79
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
303 additions
and
5 deletions
+303
-5
bigsys-auth/pom.xml
bigsys-auth/pom.xml
+62
-0
bigsys-auth/src/main/java/com/bigsys/auth/MyController.java
bigsys-auth/src/main/java/com/bigsys/auth/MyController.java
+10
-2
bigsys-auth/src/main/resources/applicationContext.xml
bigsys-auth/src/main/resources/applicationContext.xml
+1
-0
bigsys-auth/src/main/resources/dubbo-config.xml
bigsys-auth/src/main/resources/dubbo-config.xml
+1
-1
bigsys-auth/src/main/resources/generator.xml
bigsys-auth/src/main/resources/generator.xml
+43
-0
bigsys-auth/src/main/resources/jdbc.properties
bigsys-auth/src/main/resources/jdbc.properties
+12
-0
bigsys-auth/src/main/resources/mybatis.xml
bigsys-auth/src/main/resources/mybatis.xml
+44
-0
bigsys-auth/src/main/resources/spring-mvc.xml
bigsys-auth/src/main/resources/spring-mvc.xml
+17
-1
bigsys-auth/src/main/webapp/WEB-INF/web.xml
bigsys-auth/src/main/webapp/WEB-INF/web.xml
+19
-0
bigsys-auth/src/test/resources/generatorConfig.properties
bigsys-auth/src/test/resources/generatorConfig.properties
+16
-0
bigsys-auth/src/test/resources/generatorConfig.xml
bigsys-auth/src/test/resources/generatorConfig.xml
+72
-0
bigsys-dubbo/src/main/resources/dubbo-config.xml
bigsys-dubbo/src/main/resources/dubbo-config.xml
+1
-1
bigsys-spring/pom.xml
bigsys-spring/pom.xml
+5
-0
No files found.
bigsys-auth/pom.xml
View file @
a45c842d
...
...
@@ -10,11 +10,15 @@
<packaging>
war
</packaging>
<name>
auth Maven Webapp
</name>
<url>
http://maven.apache.org
</url>
<description>
用户和应用授权中心
</description>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.build.jdk>
1.8
</project.build.jdk>
<plugin.maven-compiler>
3.1
</plugin.maven-compiler>
<!-- plugin setting -->
<mybatis.generator.generatorConfig.xml>
${basedir}/src/test/resources/generatorConfig.xml
</mybatis.generator.generatorConfig.xml>
<mybatis.generator.generatorConfig.properties>
file:///${basedir}/src/test/resources/generatorConfig.properties
</mybatis.generator.generatorConfig.properties>
</properties>
<dependencies>
...
...
@@ -31,10 +35,56 @@
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis
</artifactId>
<version>
3.4.4
</version>
</dependency>
<dependency>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis-spring
</artifactId>
<version>
1.3.1
</version>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
5.1.42
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid
</artifactId>
<version>
1.0.31
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-core
</artifactId>
<version>
2.8.8
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
<version>
2.8.8
</version>
</dependency>
</dependencies>
<build>
<finalName>
bigsys-auth
</finalName>
<resources>
<resource>
<directory>
src/main/java
</directory>
<includes>
<include>
**/*.properties
</include>
<include>
**/*.xml
</include>
</includes>
<filtering>
true
</filtering>
</resource>
</resources>
<plugins>
<!--Maven编译插件 配置 -->
<plugin>
...
...
@@ -47,6 +97,18 @@
<encoding>
${project.build.sourceEncoding}
</encoding>
</configuration>
</plugin>
<!-- Mybatis generator代码生成插件 配置 -->
<plugin>
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-maven-plugin
</artifactId>
<version>
1.3.5
</version>
<configuration>
<configurationFile>
${mybatis.generator.generatorConfig.xml}
</configurationFile>
<overwrite>
true
</overwrite>
<verbose>
true
</verbose>
</configuration>
</plugin>
</plugins>
</build>
</project>
bigsys-auth/src/main/java/com/bigsys/auth/MyController.java
View file @
a45c842d
package
com
.
bigsys
.
auth
;
import
com.bigsys.auth.db.dao.BsTestMapper
;
import
com.bigsys.auth.db.model.BsTest
;
import
com.bigsys.dubbo.TestService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -18,14 +20,20 @@ public class MyController {
@Resource
private
TestService
testService
;
@Resource
BsTestMapper
bsTestMapper
;
@RequestMapping
(
value
=
"/test"
)
@ResponseBody
public
String
testSay
(
@RequestParam
(
value
=
"name"
,
defaultValue
=
""
)
String
name
){
public
BsTest
testSay
(
@RequestParam
(
value
=
"name"
,
defaultValue
=
""
)
String
name
){
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
"Dubbo: "
).
append
(
""
);
System
.
out
.
println
(
testService
.
sayHello
());
return
testService
.
sayHello
();
BsTest
bsTest
=
new
BsTest
();
bsTest
.
setName
(
"呜呜呜呜无无"
);
// bsTestMapper.insert(bsTest);
System
.
out
.
println
(
bsTestMapper
.
selectByPrimaryKey
(
1
));
return
bsTestMapper
.
selectByPrimaryKey
(
1
);
}
}
bigsys-auth/src/main/resources/applicationContext.xml
View file @
a45c842d
...
...
@@ -11,5 +11,6 @@
<import
resource=
"dubbo-config.xml"
/>
<import
resource=
"spring-mvc.xml"
/>
<import
resource=
"mybatis.xml"
/>
</beans>
\ No newline at end of file
bigsys-auth/src/main/resources/dubbo-config.xml
View file @
a45c842d
...
...
@@ -10,7 +10,7 @@
<dubbo:application
name=
"test_consumer"
/>
<!-- 使用zookeeper注册中心暴露服务地址 -->
<dubbo:registry
address=
"zookeeper://192.168.
31.147
:2181"
/>
<dubbo:registry
address=
"zookeeper://192.168.
1.65
:2181"
/>
<!-- 用dubbo协议在20880端口暴露服务 -->
<!--dubbo:protocol name="dubbo" port="20880" /-->
...
...
bigsys-auth/src/main/resources/generator.xml
0 → 100644
View file @
a45c842d
<?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>
<!-- !!!! Driver Class Path !!!! -->
<classPathEntry
location=
""
/>
<context
id=
"context"
targetRuntime=
"MyBatis3"
>
<commentGenerator>
<property
name=
"suppressAllComments"
value=
"false"
/>
<property
name=
"suppressDate"
value=
"true"
/>
</commentGenerator>
<!-- !!!! Database Configurations !!!! -->
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
connectionURL=
""
userId=
"${username}"
password=
""
/>
<javaTypeResolver>
<property
name=
"forceBigDecimals"
value=
"false"
/>
</javaTypeResolver>
<!-- !!!! Model Configurations !!!! -->
<javaModelGenerator
targetPackage=
""
targetProject=
"THIS_CONFIGURATION_IS_NOT_REQUIRED"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
<property
name=
"trimStrings"
value=
"true"
/>
</javaModelGenerator>
<!-- !!!! Mapper XML Configurations !!!! -->
<sqlMapGenerator
targetPackage=
""
targetProject=
"THIS_CONFIGURATION_IS_NOT_REQUIRED"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
</sqlMapGenerator>
<!-- !!!! Mapper Interface Configurations !!!! -->
<javaClientGenerator
targetPackage=
""
targetProject=
"THIS_CONFIGURATION_IS_NOT_REQUIRED"
type=
"XMLMAPPER"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
</javaClientGenerator>
<!-- !!!! Table Configurations !!!! -->
<table
tableName=
""
enableCountByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
enableUpdateByExample=
"false"
/>
</context>
</generatorConfiguration>
\ No newline at end of file
bigsys-auth/src/main/resources/jdbc.properties
0 → 100644
View file @
a45c842d
driver
=
com.mysql.jdbc.Driver
url
=
jdbc:mysql://localhost:3306/bigsys?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
username
=
root
password
=
root
#配置初始化大小、最小、最大
initialSize
=
1
minIdle
=
1
maxActive
=
20
#配置获取连接等待超时的时间
maxWait
=
60000
\ No newline at end of file
bigsys-auth/src/main/resources/mybatis.xml
0 → 100644
View file @
a45c842d
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
>
<!-- 引入配置文件 -->
<bean
id=
"propertyConfigurer"
class=
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
<property
name=
"location"
value=
"classpath:jdbc.properties"
/>
</bean>
<bean
id=
"dataSource"
class=
"com.alibaba.druid.pool.DruidDataSource"
destroy-method=
"close"
>
<property
name=
"driverClassName"
value=
"${driver}"
/>
<property
name=
"url"
value=
"${url}"
/>
<property
name=
"username"
value=
"${username}"
/>
<property
name=
"password"
value=
"${password}"
/>
<!-- 初始化连接大小 -->
<property
name=
"initialSize"
value=
"${initialSize}"
/>
<!-- 连接池最大数量 -->
<property
name=
"maxActive"
value=
"${maxActive}"
/>
<!-- 连接池最小空闲 -->
<property
name=
"minIdle"
value=
"${minIdle}"
/>
<!-- 获取连接最大等待时间 -->
<property
name=
"maxWait"
value=
"${maxWait}"
/>
</bean>
<!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 -->
<bean
id=
"sqlSessionFactory"
class=
"org.mybatis.spring.SqlSessionFactoryBean"
>
<property
name=
"dataSource"
ref=
"dataSource"
/>
<!-- 自动扫描mapping.xml文件,**表示迭代查找 -->
<property
name=
"mapperLocations"
value=
"classpath:com/bigsys/auth/**/*.xml"
/>
</bean>
<!-- DAO接口所在包名,Spring会自动查找其下的类 ,包下的类需要使用@MapperScan注解,否则容器注入会失败 -->
<bean
class=
"org.mybatis.spring.mapper.MapperScannerConfigurer"
>
<property
name=
"basePackage"
value=
"com.bigsys.auth.*"
/>
<property
name=
"sqlSessionFactoryBeanName"
value=
"sqlSessionFactory"
/>
</bean>
<!-- (事务管理)transaction manager, use JtaTransactionManager for global tx -->
<bean
id=
"transactionManager"
class=
"org.springframework.jdbc.datasource.DataSourceTransactionManager"
>
<property
name=
"dataSource"
ref=
"dataSource"
/>
</bean>
</beans>
\ No newline at end of file
bigsys-auth/src/main/resources/spring-mvc.xml
View file @
a45c842d
...
...
@@ -12,5 +12,21 @@
<context:component-scan
base-package=
"com.bigsys.auth"
/>
<mvc:annotation-driven
/>
<mvc:annotation-driven>
<mvc:message-converters>
<bean
class=
"org.springframework.http.converter.StringHttpMessageConverter"
>
<constructor-arg
value=
"UTF-8"
/>
</bean>
<bean
class=
"org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"
>
<property
name=
"supportedMediaTypes"
>
<list>
<value>
application/json
</value>
<value>
text/html;charset=UTF-8
</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
</beans>
\ No newline at end of file
bigsys-auth/src/main/webapp/WEB-INF/web.xml
View file @
a45c842d
...
...
@@ -9,6 +9,25 @@
<welcome-file>
index.htm
</welcome-file>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<!-- 配置Spring字符编码过滤器 -->
<filter>
<filter-name>
encodingFilter
</filter-name>
<filter-class>
org.springframework.web.filter.CharacterEncodingFilter
</filter-class>
<init-param>
<param-name>
encoding
</param-name>
<param-value>
UTF-8
</param-value>
</init-param>
<init-param>
<param-name>
forceEncoding
</param-name>
<param-value>
true
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>
encodingFilter
</filter-name>
<url-pattern>
/*
</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>
dispatcher
</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
...
...
bigsys-auth/src/test/resources/generatorConfig.properties
0 → 100644
View file @
a45c842d
# 数据库驱动jar 路径
drive.class.path
=
/Users/fangzhipeng/.m2/repository/mysql/mysql-connector-java/5.1.30/mysql-connector-java-5.1.30.jar
# 数据库连接参数
jdbc.driver
=
com.mysql.jdbc.Driver
jdbc.url
=
jdbc:mysql://localhost:3306/bigsys?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
jdbc.username
=
root
jdbc.password
=
root
# 包路径配置
model.package
=
com.bigsys.auth.db.model
dao.package
=
com.bigsys.auth.db.dao
xml.mapper.package
=
com.bigsys.auth.db.dao
target.project
=
src/main/java
\ No newline at end of file
bigsys-auth/src/test/resources/generatorConfig.xml
0 → 100644
View file @
a45c842d
<?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">
<!-- 配置Run As Maven build : Goals 参数 : mybatis-generator:generate -Dmybatis.generator.overwrite=true -->
<!-- 配置 tableName,使用 Run As Maven build 生成 dao model 层 -->
<generatorConfiguration>
<!-- 配置文件路径 -->
<properties
url=
"${mybatis.generator.generatorConfig.properties}"
/>
<!--数据库驱动包路径 -->
<classPathEntry
location=
"${drive.class.path}"
/>
<context
id=
"DB2Tables"
targetRuntime=
"MyBatis3"
>
<!--关闭注释 -->
<commentGenerator>
<property
name=
"suppressAllComments"
value=
"true"
/>
</commentGenerator>
<!--数据库连接信息 -->
<jdbcConnection
driverClass=
"${jdbc.driver}"
connectionURL=
"${jdbc.url}"
userId=
"${jdbc.username}"
password=
"${jdbc.password}"
>
</jdbcConnection>
<!--生成的model 包路径 -->
<javaModelGenerator
targetPackage=
"${model.package}"
targetProject=
"${target.project}"
>
<property
name=
"enableSubPackages"
value=
"ture"
/>
<property
name=
"trimStrings"
value=
"true"
/>
</javaModelGenerator>
<!--生成xml mapper文件 路径 -->
<sqlMapGenerator
targetPackage=
"${xml.mapper.package}"
targetProject=
"${target.project}"
>
<property
name=
"enableSubPackages"
value=
"ture"
/>
</sqlMapGenerator>
<!-- 生成的Dao接口 的包路径 -->
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"${dao.package}"
targetProject=
"${target.project}"
>
<property
name=
"enableSubPackages"
value=
"ture"
/>
</javaClientGenerator>
<!--对应数据库表名 -->
<!-- <table tableName="rt_upload_stop_info" domainObjectName="UploadStopInfo" >
<columnOverride column="recordTime" javaType="String"></columnOverride>
</table> -->
<table
tableName=
"bigsys_test"
domainObjectName=
"BsTest"
>
</table>
<!--<table tableName="sub_line" domainObjectName="SubLine">-->
<!--<property name="useActualColumnNames" value="true"/>-->
<!--<columnOverride column="createTime" javaType="String"></columnOverride>-->
<!--<columnOverride column="lastModifyTime" javaType="String"></columnOverride>-->
<!--<columnOverride column="publishTime" javaType="String"></columnOverride>-->
<!--<columnOverride column="snapshotTime" javaType="String"></columnOverride>-->
<!--</table>-->
<!-- <table tableName="base_stop" domainObjectName="BaseStop">
<property name="useActualColumnNames" value="true"/>
</table> -->
<!--
<table tableName="daba_demand" domainObjectName="DabaDemand">
</table> -->
<!--<table tableName="line_promotion" domainObjectName="LinePromotion">-->
<!--<property name="useActualColumnNames" value="true"/>-->
<!--</table> -->
<!--<table tableName="daba_inf_line" domainObjectName="DabaInfLine">-->
<!--<property name="useActualColumnNames" value="true"/>-->
<!--<columnOverride column="publishTime" javaType="String"></columnOverride>-->
<!--</table>-->
</context>
</generatorConfiguration>
\ No newline at end of file
bigsys-dubbo/src/main/resources/dubbo-config.xml
View file @
a45c842d
...
...
@@ -10,7 +10,7 @@
<dubbo:application
name=
"test_provider"
/>
<!-- 使用zookeeper注册中心暴露服务地址 -->
<dubbo:registry
address=
"zookeeper://
192.168.31.147
:2181"
/>
<dubbo:registry
address=
"zookeeper://
localhost
:2181"
/>
<!-- 用dubbo协议在20880端口暴露服务 -->
<dubbo:protocol
name=
"dubbo"
port=
"20881"
/>
...
...
bigsys-spring/pom.xml
View file @
a45c842d
...
...
@@ -78,6 +78,11 @@
<artifactId>
spring-instrument-tomcat
</artifactId>
<version>
${spring.vesion}
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-jdbc
</artifactId>
<version>
${spring.vesion}
</version>
</dependency>
<dependency>
<groupId>
org.aspectj
</groupId>
<artifactId>
aspectjweaver
</artifactId>
...
...
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