瀏覽代碼

add zheng-ucenter

shuzheng 8 年之前
父節點
當前提交
32d83d7024
共有 22 個文件被更改,包括 689 次插入0 次删除
  1. 27 0
      zheng-ucenter/pom.xml
  2. 74 0
      zheng-ucenter/zheng-ucenter-dao/pom.xml
  3. 13 0
      zheng-ucenter/zheng-ucenter-dao/src/main/java/com/zheng/ucenter/dao/App.java
  4. 74 0
      zheng-ucenter/zheng-ucenter-dao/src/main/resources/generatorConfig.xml
  5. 9 0
      zheng-ucenter/zheng-ucenter-dao/src/main/resources/jdbc.properties
  6. 7 0
      zheng-ucenter/zheng-ucenter-dao/src/main/resources/redis.properties
  7. 108 0
      zheng-ucenter/zheng-ucenter-home/pom.xml
  8. 15 0
      zheng-ucenter/zheng-ucenter-home/src/main/java/com/zheng/ucenter/home/controller/BaseController.java
  9. 26 0
      zheng-ucenter/zheng-ucenter-home/src/main/resources/applicationContext-threadpool.xml
  10. 1 0
      zheng-ucenter/zheng-ucenter-home/src/main/resources/config.properties
  11. 23 0
      zheng-ucenter/zheng-ucenter-home/src/main/resources/log4j.properties
  12. 1 0
      zheng-ucenter/zheng-ucenter-home/src/main/resources/profiles/dev.properties
  13. 1 0
      zheng-ucenter/zheng-ucenter-home/src/main/resources/profiles/prod.properties
  14. 1 0
      zheng-ucenter/zheng-ucenter-home/src/main/resources/profiles/test.properties
  15. 13 0
      zheng-ucenter/zheng-ucenter-home/src/main/resources/springMVC-servlet.xml
  16. 17 0
      zheng-ucenter/zheng-ucenter-home/src/main/webapp/WEB-INF/jsp/404.jsp
  17. 43 0
      zheng-ucenter/zheng-ucenter-home/src/main/webapp/WEB-INF/jsp/500.jsp
  18. 17 0
      zheng-ucenter/zheng-ucenter-home/src/main/webapp/WEB-INF/jsp/index.jsp
  19. 97 0
      zheng-ucenter/zheng-ucenter-home/src/main/webapp/WEB-INF/web.xml
  20. 71 0
      zheng-ucenter/zheng-ucenter-service/pom.xml
  21. 13 0
      zheng-ucenter/zheng-ucenter-service/src/main/java/com/zheng/ucenter/service/App.java
  22. 38 0
      zheng-ucenter/zheng-ucenter-service/src/test/java/com/zheng/ucenter/service/AppTest.java

+ 27 - 0
zheng-ucenter/pom.xml

@@ -0,0 +1,27 @@
+<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.zheng</groupId>
+    <artifactId>zheng-ucenter</artifactId>
+    <version>1.0.0</version>
+    <packaging>pom</packaging>
+
+    <name>zheng-ucenter</name>
+    <url>http://www.zhangshuzheng.cn</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+        <maven.compiler.source>1.7</maven.compiler.source>
+        <maven.compiler.target>1.7</maven.compiler.target>
+        <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
+    </properties>
+
+    <modules>
+        <module>zheng-ucenter-dao</module>
+        <module>zheng-ucenter-service</module>
+        <module>zheng-ucenter-home</module>
+    </modules>
+
+</project>

+ 74 - 0
zheng-ucenter/zheng-ucenter-dao/pom.xml

@@ -0,0 +1,74 @@
+<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>
+
+    <parent>
+        <groupId>com.zheng</groupId>
+        <artifactId>zheng-ucenter</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>zheng-ucenter-dao</artifactId>
+    <packaging>jar</packaging>
+
+    <name>zheng-ucenter-dao</name>
+    <url>http://www.zhangshuzheng.cn</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.zheng</groupId>
+            <artifactId>zheng-common</artifactId>
+            <version>1.0.0</version>
+            <type>jar</type>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>zheng-ucenter-dao</finalName>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.xml</include>
+                </includes>
+                <filtering>true</filtering>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.mybatis.generator</groupId>
+                <artifactId>mybatis-generator-maven-plugin</artifactId>
+                <version>1.3.2</version>
+                <dependencies>
+                    <dependency>
+                        <groupId>com.zheng</groupId>
+                        <artifactId>zheng-common</artifactId>
+                        <version>1.0.0</version>
+                    </dependency>
+                </dependencies>
+                <configuration>
+                    <verbose>true</verbose>
+                    <overwrite>true</overwrite>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+                <configuration>
+                    <!--是否跳过单元测试-->
+                    <skipTests>true</skipTests>
+                    <!--是否忽略单元测试错误-->
+                    <testFailureIgnore>true</testFailureIgnore>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 13 - 0
zheng-ucenter/zheng-ucenter-dao/src/main/java/com/zheng/ucenter/dao/App.java

@@ -0,0 +1,13 @@
+package com.zheng.ucenter.dao;
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}

+ 74 - 0
zheng-ucenter/zheng-ucenter-dao/src/main/resources/generatorConfig.xml

@@ -0,0 +1,74 @@
+<?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"></properties>
+
+	<!-- mysql驱动包 -->
+	<classPathEntry location="${classPathEntry}" />
+
+	<context id="context" targetRuntime="MyBatis3">
+
+		<property name="javaFileEncoding" value="UTF-8"/>
+
+		<!-- 由于beginningDelimiter和endingDelimiter的默认值为双引号("),在Mysql中不能这么写,所以还要将这两个默认值改为**反单引号(`)**,配置如下:  -->
+		<property name="beginningDelimiter" value=""/>
+		<property name="endingDelimiter" value=""/>
+
+		<!-- 为生成的Java模型创建一个toString方法 -->
+        <plugin type="org.mybatis.generator.plugins.ToStringPlugin"></plugin>
+
+		<!-- 为生成的Java模型类添加序列化接口,并生成serialVersionUID字段 -->
+		<plugin type="org.mybatis.generator.plugins.SerializablePlugin">
+			<property name="suppressJavaInterface" value="false"/>
+		</plugin>
+
+		<!-- 生成一个新的selectByExample方法,这个方法可以接受一个RowBounds参数,主要用来实现分页 -->
+        <plugin type="com.zheng.common.plugin.PaginationPlugin"></plugin>
+
+		<!-- 生成在XML中的<cache>元素 -->
+		<plugin type="org.mybatis.generator.plugins.CachePlugin">
+			<!-- 使用ehcache -->
+			<property name="cache_type" value="org.mybatis.caches.ehcache.LoggingEhcache" />
+			<!-- 内置cache配置 -->
+			<!--
+			<property name="cache_eviction" value="LRU" />
+			<property name="cache_flushInterval" value="60000" />
+			<property name="cache_readOnly" value="true" />
+			<property name="cache_size" value="1024" />
+			-->
+		</plugin>
+
+		<!-- Java模型生成equals和hashcode方法 -->
+		<plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"></plugin>
+
+		<!-- 生成的代码去掉注释 -->
+		<commentGenerator>
+			<property name="suppressAllComments" value="true" />
+		</commentGenerator>
+
+		<!-- 数据库连接 -->
+		<jdbcConnection driverClass="${jdbc.driver}"
+			connectionURL="${jdbc.url}"
+			userId="${jdbc.username}"
+			password="${jdbc.password}" />
+
+		<!-- model生成 -->
+		<javaModelGenerator targetPackage="${generator.javaModelGenerator.targetPackage}" targetProject="src/main/java" />
+
+		<!-- MapperXML生成 -->
+		<sqlMapGenerator targetPackage="${generator.sqlMapGenerator.targetPackage}" targetProject="src/main/java" />
+
+		<!-- Mapper接口生成 -->
+		<javaClientGenerator targetPackage="${generator.javaClientGenerator.targetPackage}" targetProject="src/main/java" type="XMLMAPPER" />
+
+		<!-- 需要映射的表 -->
+		<table tableName="user" domainObjectName="User">
+			<generatedKey column="id" sqlStatement="MySql" identity="true" />
+		</table>
+		<table tableName="book" domainObjectName="Book">
+			<generatedKey column="id" sqlStatement="MySql" identity="true" />
+		</table>
+	</context>
+</generatorConfiguration>

+ 9 - 0
zheng-ucenter/zheng-ucenter-dao/src/main/resources/jdbc.properties

@@ -0,0 +1,9 @@
+jdbc.driver=com.mysql.jdbc.Driver
+jdbc.url=jdbc\:mysql\://127.0.0.1\:3306/zheng?useUnicode\=true&characterEncoding\=utf-8&autoReconnect\=true
+jdbc.username=root
+jdbc.password=123456
+
+classPathEntry=D:/mysql-connector-java-5.1.34.jar
+generator.javaModelGenerator.targetPackage=com.zheng.ucenter.dao.model
+generator.sqlMapGenerator.targetPackage=com.zheng.ucenter.dao.mapper
+generator.javaClientGenerator.targetPackage=com.zheng.ucenter.dao.mapper

+ 7 - 0
zheng-ucenter/zheng-ucenter-dao/src/main/resources/redis.properties

@@ -0,0 +1,7 @@
+ip=127.0.0.1
+port=6379
+password=
+max_active=500
+max_idle=5
+max_wait=10000
+timeout=10000

+ 108 - 0
zheng-ucenter/zheng-ucenter-home/pom.xml

@@ -0,0 +1,108 @@
+<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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>com.zheng</groupId>
+        <artifactId>zheng-ucenter</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>zheng-ucenter-home</artifactId>
+    <packaging>war</packaging>
+
+    <name>zheng-ucenter-home Maven Webapp</name>
+    <url>http://www.zhangshuzheng.cn</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.zheng</groupId>
+            <artifactId>zheng-ucenter-service</artifactId>
+            <version>1.0.0</version>
+            <type>jar</type>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>jstl</artifactId>
+            <version>1.2</version>
+        </dependency>
+    </dependencies>
+
+    <profiles>
+        <profile>
+            <id>dev</id>
+            <properties>
+                <env>dev</env>
+            </properties>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+        </profile>
+        <profile>
+            <id>test</id>
+            <properties>
+                <env>test</env>
+            </properties>
+        </profile>
+        <profile>
+            <id>prod</id>
+            <properties>
+                <env>prod</env>
+            </properties>
+        </profile>
+    </profiles>
+
+    <build>
+        <finalName>zheng-ucenter-home</finalName>
+        <filters>
+            <filter>src/main/resources/profiles/${env}.properties</filter>
+        </filters>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+        <plugins>
+            <!-- jetty插件 -->
+            <plugin>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-maven-plugin</artifactId>
+                <version>9.0.0.v20130308</version>
+                <configuration>
+                    <scanIntervalSeconds>3</scanIntervalSeconds>
+                    <webApp>
+                        <contextPath>/zheng-ucenter-home</contextPath>
+                    </webApp>
+                    <httpConnector>
+                        <port>8080</port>
+                    </httpConnector>
+                    <reload>automatic</reload>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+                <configuration>
+                    <!--是否跳过单元测试-->
+                    <skipTests>true</skipTests>
+                    <!--是否忽略单元测试错误-->
+                    <testFailureIgnore>true</testFailureIgnore>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 15 - 0
zheng-ucenter/zheng-ucenter-home/src/main/java/com/zheng/ucenter/home/controller/BaseController.java

@@ -0,0 +1,15 @@
+package com.zheng.ucenter.home.controller;
+
+/**
+ * 控制器基类
+ * @author shuzheng
+ * @date 2016年7月7日 上午10:08:47
+ */
+public class BaseController {
+	
+	public static final String RESULT = "result";
+	public static final String DATA = "data";
+	public static final String SUCCESS = "success";
+	public static final String FAILED = "failed";
+
+}

+ 26 - 0
zheng-ucenter/zheng-ucenter-home/src/main/resources/applicationContext-threadpool.xml

@@ -0,0 +1,26 @@
+<?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-3.0.xsd">
+
+	<!-- 线程池配置 -->
+	<bean id="threadPoolTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
+		<!-- 线程池维护线程的最少数量 -->
+		<property name="corePoolSize" value="50" />
+		<!--  线程池维护线程的最大数量,默认为Integer.MAX_VALUE -->
+		<property name="maxPoolSize" value="1000" />
+		<!-- 线程池所使用的缓冲队列,一般需要设置值>=notifyScheduledMainExecutor.maxNum;默认为Integer.MAX_VALUE -->
+		<property name="queueCapacity" value="20000" />
+		<!-- 线程池维护线程所允许的空闲时间,默认为60s -->
+		<property name="keepAliveSeconds" value="300" />
+		<!-- 线程池对拒绝任务(无线程可用)的处理策略,目前只支持AbortPolicy、CallerRunsPolicy;默认为后者 -->
+		<property name="rejectedExecutionHandler">
+			<!-- AbortPolicy:直接抛出java.util.concurrent.RejectedExecutionException异常 -->
+			<!-- CallerRunsPolicy:主线程直接执行该任务,执行完之后尝试添加下一个任务到线程池中,可以有效降低向线程池内添加任务的速度 -->
+			<!-- DiscardOldestPolicy:抛弃旧的任务、暂不支持;会导致被丢弃的任务无法再次被执行 -->
+			<!-- DiscardPolicy:抛弃当前任务、暂不支持;会导致被丢弃的任务无法再次被执行 -->
+			<bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy" />
+		</property>
+	</bean>
+
+</beans>

+ 1 - 0
zheng-ucenter/zheng-ucenter-home/src/main/resources/config.properties

@@ -0,0 +1 @@
+env=${profile.env}

+ 23 - 0
zheng-ucenter/zheng-ucenter-home/src/main/resources/log4j.properties

@@ -0,0 +1,23 @@
+#off/fatal/error/warn/info/debug/all
+log4j.debug=false
+log4j.rootLogger=info, stdout
+
+# Console output
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
+
+#Spring logging configuration
+log4j.category.org.springframework = warn
+
+#Druid logging configuration
+log4j.logger.druid.sql=warn,stdout
+log4j.logger.druid.sql.DataSource=warn,stdout
+log4j.logger.druid.sql.Connection=warn,stdout
+log4j.logger.druid.sql.Statement=warn,stdout
+log4j.logger.druid.sql.ResultSet=warn,stdout
+
+# MyBatis logging configuration
+log4j.logger.com.zheng.qa.dao.mapper=debug
+#log4j.logger.com.zheng.qa.dao.mapper.UserMapper=debug
+#log4j.logger.com.zheng.qa.dao.mapper.UserMapper.selectUser=debug

+ 1 - 0
zheng-ucenter/zheng-ucenter-home/src/main/resources/profiles/dev.properties

@@ -0,0 +1 @@
+profile.env=dev

+ 1 - 0
zheng-ucenter/zheng-ucenter-home/src/main/resources/profiles/prod.properties

@@ -0,0 +1 @@
+profile.env=prod

+ 1 - 0
zheng-ucenter/zheng-ucenter-home/src/main/resources/profiles/test.properties

@@ -0,0 +1 @@
+profile.env=test

+ 13 - 0
zheng-ucenter/zheng-ucenter-home/src/main/resources/springMVC-servlet.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:mvc="http://www.springframework.org/schema/mvc"
+	xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/mvc
+        http://www.springframework.org/schema/mvc/spring-mvc.xsd">
+
+	
+
+</beans>

+ 17 - 0
zheng-ucenter/zheng-ucenter-home/src/main/webapp/WEB-INF/jsp/404.jsp

@@ -0,0 +1,17 @@
+<%@ page contentType="text/html; charset=utf-8"%>
+<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
+<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
+<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
+<c:set var="basePath" value="${pageContext.request.contextPath}"/>
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title><spring:message code="404"/></title>
+</head>
+<body>
+404
+</body>
+</html>

+ 43 - 0
zheng-ucenter/zheng-ucenter-home/src/main/webapp/WEB-INF/jsp/500.jsp

@@ -0,0 +1,43 @@
+<%@ page contentType="text/html; charset=utf-8"%>
+<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
+<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
+<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
+<c:set var="basePath" value="${pageContext.request.contextPath}"/>
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>500</title>
+</head>
+<body>
+<center style="margin:50px auto">
+	<p>错误代码:500<%//=request.getAttribute("javax.servlet.error.status_code")%></p>
+	<p>您访问的页面有错误!</p>
+	<p>错误原因:${error.message}</p>
+	<p>错误内容:${error}</p>
+	<p><!--页面将在<span id="stime">5</span>秒后-->跳转到<a href="${pageContext.request.contextPath}/">首页</a>!</p>
+</center>
+<%
+/**
+监控出错人的IP
+String ip = request.getHeader(" x-forwarded-for");
+if (ip == null || ip.length() == 0 || " unknown".equalsIgnoreCase(ip)) {
+	ip = request.getHeader(" Proxy-Client-IP"); // 获取代理ip
+}
+if (ip == null || ip.length() == 0 || " unknown".equalsIgnoreCase(ip)) {
+	ip = request.getHeader(" WL-Proxy-Client-IP"); // 获取代理ip
+}
+if (ip == null || ip.length() == 0 || " unknown".equalsIgnoreCase(ip)) {
+	ip = request.getRemoteAddr(); // 获取真实ip
+}
+//out.println(ip+"<br/><br/>你的地址是:<br/><br/>");
+
+Document doc = Jsoup.connect("http://ip.chinaz.com/?IP="+ip).timeout(9000).get();
+Element e = doc.select("#status").first();
+//out.println(e);
+*/
+%>
+</body>
+</html>

+ 17 - 0
zheng-ucenter/zheng-ucenter-home/src/main/webapp/WEB-INF/jsp/index.jsp

@@ -0,0 +1,17 @@
+<%@ page contentType="text/html; charset=utf-8"%>
+<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
+<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
+<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
+<c:set var="basePath" value="${pageContext.request.contextPath}"/>
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8"/>
+    <title>首页</title>
+</head>
+<body>
+
+</body>
+</html>

+ 97 - 0
zheng-ucenter/zheng-ucenter-home/src/main/webapp/WEB-INF/web.xml

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         version="2.5">
+
+    <!-- 强制进行转码 -->
+    <filter>
+        <filter-name>CharacterEncodingFilter</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>
+    </filter>
+    <filter-mapping>
+        <filter-name>CharacterEncodingFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+        <dispatcher>REQUEST</dispatcher>
+        <dispatcher>FORWARD</dispatcher>
+    </filter-mapping>
+
+    <!-- 默认的spring配置文件是在WEB-INF下的applicationContext.xml -->
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>
+            classpath*:applicationContext*.xml
+        </param-value>
+    </context-param>
+
+    <!-- 日志配置文件 -->
+    <context-param>
+        <param-name>log4jConfigLocation</param-name>
+        <param-value>classpath:log4j.properties</param-value>
+    </context-param>
+
+    <!-- springMVC的核心控制器 -->
+    <servlet>
+        <servlet-name>springMVC</servlet-name>
+        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+        <init-param>
+            <param-name>contextConfigLocation</param-name>
+            <param-value>classpath*:springMVC-servlet.xml</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>springMVC</servlet-name>
+        <url-pattern>/</url-pattern>
+    </servlet-mapping>
+
+    <!-- Spring Security -->
+    <!--
+    <filter>
+        <filter-name>springSecurityFilterChain</filter-name>
+        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+    </filter>
+    <filter-mapping>
+        <filter-name>springSecurityFilterChain</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+    -->
+
+    <!-- Druid连接池监控页面 -->
+    <servlet>
+        <servlet-name>DruidStatView</servlet-name>
+        <servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>DruidStatView</servlet-name>
+        <url-pattern>/druid/*</url-pattern>
+    </servlet-mapping>
+
+    <!-- session配置 -->
+    <session-config>
+        <session-timeout>120</session-timeout>
+    </session-config>
+
+    <!-- 欢迎页面 -->
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+        <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+
+    <!-- 错误页面 -->
+    <error-page>
+        <error-code>404</error-code>
+        <location>/WEB-INF/jsp/404.jsp</location>
+    </error-page>
+    <error-page>
+        <error-code>500</error-code>
+        <location>/WEB-INF/jsp/500.jsp</location>
+    </error-page>
+</web-app>

+ 71 - 0
zheng-ucenter/zheng-ucenter-service/pom.xml

@@ -0,0 +1,71 @@
+<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>
+
+    <parent>
+        <groupId>com.zheng</groupId>
+        <artifactId>zheng-ucenter</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>zheng-ucenter-service</artifactId>
+    <packaging>jar</packaging>
+
+    <name>zheng-ucenter-service</name>
+    <url>http://www.zhangshuzheng.cn</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.zheng</groupId>
+            <artifactId>zheng-ucenter-dao</artifactId>
+            <version>1.0.0</version>
+            <type>jar</type>
+        </dependency>
+        <!-- servlet -->
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>zheng-ucenter-service</finalName>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.xml</include>
+                </includes>
+                <filtering>true</filtering>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+                <configuration>
+                    <!--是否跳过单元测试-->
+                    <skipTests>true</skipTests>
+                    <!--是否忽略单元测试错误-->
+                    <testFailureIgnore>true</testFailureIgnore>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 13 - 0
zheng-ucenter/zheng-ucenter-service/src/main/java/com/zheng/ucenter/service/App.java

@@ -0,0 +1,13 @@
+package com.zheng.ucenter.service;
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}

+ 38 - 0
zheng-ucenter/zheng-ucenter-service/src/test/java/com/zheng/ucenter/service/AppTest.java

@@ -0,0 +1,38 @@
+package com.zheng.ucenter.service;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}