完成zheng-api子系统架构

This commit is contained in:
shuzheng 2017-02-19 13:06:31 +08:00
parent 238fcc8815
commit 1314c4679e
43 changed files with 1083 additions and 0 deletions

View File

@ -5,6 +5,12 @@
<groupId>com.zheng</groupId>
<artifactId>zheng-api</artifactId>
<version>1.0.0</version>
<modules>
<module>zheng-api-common</module>
<module>zheng-api-rpc-api</module>
<module>zheng-api-rpc-service</module>
<module>zheng-api-server</module>
</modules>
<packaging>pom</packaging>
<name>zheng-api</name>

View File

@ -0,0 +1,56 @@
<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-api</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>zheng-api-common</artifactId>
<packaging>jar</packaging>
<name>zheng-api-common</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-api-common</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>

View File

@ -0,0 +1,10 @@
package com.zheng.api.common.constant;
import com.zheng.common.base.BaseConstants;
/**
* api系统常量类
* Created by shuzheng on 2017/2/19.
*/
public class ApiConstant extends BaseConstants {
}

View File

@ -0,0 +1,19 @@
package com.zheng.api.common.constant;
import com.zheng.common.base.BaseResult;
/**
* api系统常量枚举类
* Created by shuzheng on 2017/2/19.
*/
public class ApiResult extends BaseResult {
public ApiResult(int code, String message, Object data) {
super(code, message, data);
}
public ApiResult(ApiResultConstant apiResultConstant, Object data) {
super(apiResultConstant.getCode(), apiResultConstant.getMessage(), data);
}
}

View File

@ -0,0 +1,36 @@
package com.zheng.api.common.constant;
/**
* api系统接口结果常量枚举类
* Created by shuzheng on 2017/2/19.
*/
public enum ApiResultConstant {
SUCCESS(1, "success");
public int code;
public String message;
ApiResultConstant(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

View File

@ -0,0 +1,55 @@
<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-api</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>zheng-api-rpc-api</artifactId>
<packaging>jar</packaging>
<name>zheng-api-rpc-api</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-api-common</artifactId>
<version>1.0.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.zheng</groupId>
<artifactId>zheng-upms-rpc-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.zheng</groupId>
<artifactId>zheng-cms-rpc-api</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<finalName>zheng-api-rpc-api</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>
</build>
</project>

View File

@ -0,0 +1,11 @@
package com.zheng.api.rpc.api;
/**
* api系统总接口
* Created by shuzheng on 2017/2/19.
*/
public interface ApiService {
String hello(String name);
}

View File

@ -0,0 +1,20 @@
package com.zheng.api.rpc.api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 降级实现ApiService接口
* Created by shuzheng on 2017/2/19.
*/
public class ApiServiceMock implements ApiService {
private static Logger _log = LoggerFactory.getLogger(ApiServiceMock.class);
@Override
public String hello(String name) {
_log.info("ApiServiceMock => hello");
return null;
}
}

View File

@ -0,0 +1,85 @@
<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-api</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>zheng-api-rpc-service</artifactId>
<packaging>jar</packaging>
<name>zheng-api-rpc-service</name>
<url>http://www.zhangshuzheng.cn</url>
<dependencies>
<dependency>
<groupId>com.zheng</groupId>
<artifactId>zheng-api-rpc-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</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-api-rpc-service</finalName>
<filters>
<filter>src/main/resources/profiles/${env}.properties</filter>
</filters>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</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>

View File

@ -0,0 +1,21 @@
package com.zheng.api.rpc.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* 服务启动类
* Created by shuzheng on 2017/2/19.
*/
public class ZhengApiRpcServiceApplication {
private static Logger _log = LoggerFactory.getLogger(ZhengApiRpcServiceApplication.class);
public static void main(String[] args) {
_log.info(">>>>> zheng-api-rpc-service 正在启动 <<<<<");
new ClassPathXmlApplicationContext("classpath*:applicationContext*.xml");
_log.info(">>>>> zheng-api-rpc-service 启动完成 <<<<<");
}
}

View File

@ -0,0 +1,56 @@
package com.zheng.api.rpc.service.impl;
import com.zheng.api.rpc.api.ApiService;
import com.zheng.cms.rpc.api.*;
import com.zheng.upms.rpc.api.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 实现ApiService接口
* Created by shuzheng on 2017/2/19.
*/
public class ApiServiceImpl implements ApiService {
private static Logger _log = LoggerFactory.getLogger(ApiServiceImpl.class);
@Autowired
private UpmsSystemService upmsSystemService;
@Autowired
private UpmsOrganizationService upmsOrganizationService;
@Autowired
private UpmsUserService upmsUserService;
@Autowired
private UpmsRoleService upmsRoleService;
@Autowired
private UpmsPermissionService upmsPermissionService;
@Autowired
private UpmsApiService upmsApiService;
@Autowired
private CmsArticleService cmsArticleService;
@Autowired
private CmsCategoryService cmsCategoryService;
@Autowired
private CmsCommentService cmsCommentService;
@Autowired
private CmsTagService cmsTagService;
@Autowired
private UserService userService;
@Override
public String hello(String name) {
return "hello," + name + "!";
}
}

View File

@ -0,0 +1,39 @@
<?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:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<!-- 订阅服务 -->
<dubbo:consumer check="false"/>
<!-- 系统 -->
<dubbo:reference id="upmsSystemService" interface="com.zheng.upms.rpc.api.UpmsSystemService" mock="true"/>
<!-- 组织 -->
<dubbo:reference id="upmsOrganizationService" interface="com.zheng.upms.rpc.api.UpmsOrganizationService" mock="true"/>
<!-- 用户 -->
<dubbo:reference id="upmsUserService" interface="com.zheng.upms.rpc.api.UpmsUserService" mock="true"/>
<!-- 角色 -->
<dubbo:reference id="upmsRoleService" interface="com.zheng.upms.rpc.api.UpmsRoleService" mock="true"/>
<!-- 权限 -->
<dubbo:reference id="upmsPermissionService" interface="com.zheng.upms.rpc.api.UpmsPermissionService" mock="true"/>
<!-- 接口服务 -->
<dubbo:reference id="upmsApiService" interface="com.zheng.upms.rpc.api.UpmsApiService" mock="true"/>
<!-- 文章 -->
<dubbo:reference id="cmsArticleService" interface="com.zheng.cms.rpc.api.CmsArticleService" mock="true"/>
<!-- 类目 -->
<dubbo:reference id="cmsCategoryService" interface="com.zheng.cms.rpc.api.CmsCategoryService" mock="true"/>
<!-- 评论 -->
<dubbo:reference id="cmsCommentService" interface="com.zheng.cms.rpc.api.CmsCommentService" mock="true"/>
<!-- 标签 -->
<dubbo:reference id="cmsTagService" interface="com.zheng.cms.rpc.api.CmsTagService" mock="true"/>
<!-- 用户 -->
<dubbo:reference id="userService" interface="com.zheng.cms.rpc.api.UserService" mock="true"/>
</beans>

View File

@ -0,0 +1,20 @@
<?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:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
<dubbo:application name="zheng-api-rpc-service"/>
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<dubbo:protocol name="dubbo" port="20883"/>
<!-- API总系统 -->
<bean id="apiService" class="com.zheng.api.rpc.service.impl.ApiServiceImpl"/>
<dubbo:service interface="com.zheng.api.rpc.api.ApiService" ref="apiService" timeout="10000"/>
</beans>

View File

@ -0,0 +1,11 @@
<?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">
<!-- Spring容器初始化完成监听器 -->
<bean class="com.zheng.common.listener.ApplicationContextListener"></bean>
</beans>

View File

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

View File

@ -0,0 +1,11 @@
#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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,38 @@
package com.zheng;
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 );
}
}

View File

@ -0,0 +1,117 @@
<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-api</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>zheng-api-server</artifactId>
<packaging>war</packaging>
<name>zheng-api-server Maven Webapp</name>
<url>http://www.zhangshuzheng.cn</url>
<dependencies>
<dependency>
<groupId>com.zheng</groupId>
<artifactId>zheng-api-rpc-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.zheng</groupId>
<artifactId>zheng-ui</artifactId>
<version>1.0.0</version>
</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>
<!-- zheng-upms-client -->
<dependency>
<groupId>com.zheng</groupId>
<artifactId>zheng-upms-client</artifactId>
<version>1.0.0</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-api-server</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>-->
<version>9.2.7.v20150116</version>
<configuration>
<scanIntervalSeconds>3</scanIntervalSeconds>
<webApp>
<contextPath>/</contextPath>
</webApp>
<httpConnector>
<port>6666</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>

View File

@ -0,0 +1,36 @@
package com.zheng.api.server.controller;
import com.zheng.api.rpc.api.ApiService;
import com.zheng.common.base.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 后台controller
* Created by shuzheng on 2017/2/19.
*/
@Controller
@Api(value = "test", description = "test")
public class TestController extends BaseController {
private static Logger _log = LoggerFactory.getLogger(TestController.class);
@Autowired
private ApiService apiService;
@ApiOperation(value = "test")
@RequestMapping(value = "/test", method = RequestMethod.GET)
@ResponseBody
public String test(ModelMap modelMap) {
return apiService.hello("world");
}
}

View File

@ -0,0 +1,39 @@
package com.zheng.api.server.jms;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
/**
* MQ消费者
* Created by shuzheng on 2017/2/19.
*/
public class DefaultMessageQueueListener implements MessageListener {
private static Logger _log = LoggerFactory.getLogger(DefaultMessageQueueListener.class);
@Autowired
ThreadPoolTaskExecutor threadPoolTaskExecutor;
public void onMessage(final Message message) {
// 使用线程池多线程处理
threadPoolTaskExecutor.execute(new Runnable() {
public void run() {
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
try {
_log.info("消费消息:{}", textMessage.getText());
} catch (Exception e){
e.printStackTrace();
}
}
}
});
}
}

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 查找最新的schemaLocation 访问 http://www.springframework.org/schema/ -->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:jms="http://www.springframework.org/schema/jms"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/jms
http://www.springframework.org/schema/jms/spring-jms-4.1.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.8.0.xsd">
<!-- 连接工厂 -->
<bean id="activeMqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${AvtiveMQ.brokerURL}"/>
<property name="useAsyncSend" value="true"/>
</bean>
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="activeMqConnectionFactory"/>
<property name="sessionCacheSize" value="100"/>
</bean>
<!-- 点对点队列 -->
<bean id="defaultQueueDestination" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg index="0" value="com.zheng.api.server.queue.default"/>
</bean>
<!-- 一对多队列 -->
<bean id="defaultTopicDestination" class="org.apache.activemq.command.ActiveMQTopic">
<constructor-arg index="0" value="com.zheng.api.server.topic.default"/>
</bean>
<!-- 生产者 -->
<bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="pubSubDomain" value="false" />
</bean>
<bean id="jmsTopicTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="pubSubDomain" value="true" />
</bean>
<!-- 消费者 -->
<bean id="defaultMessageQueueListener" class="com.zheng.api.server.jms.DefaultMessageQueueListener"/>
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="destination" ref="defaultQueueDestination"/>
<property name="messageListener" ref="defaultMessageQueueListener"/>
<property name="sessionTransacted" value="true"/>
<!--<property name="concurrency" value="4-10"/>-->
</bean>
</beans>

View File

@ -0,0 +1,20 @@
<?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:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
<dubbo:application name="zheng-api-server"/>
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<!-- 订阅服务 -->
<dubbo:consumer check="false"/>
<!-- 总接口 -->
<dubbo:reference id="apiService" interface="com.zheng.api.rpc.api.ApiService" mock="true"/>
</beans>

View File

@ -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>

View File

@ -0,0 +1,9 @@
<?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">
<!-- 启动解压zhengAdmin-x.x.x.jar到resources目录 -->
<bean id="zhengAdminUtil" class="com.zheng.common.util.ZhengAdminUtil"></bean>
</beans>

View File

@ -0,0 +1,4 @@
env=${profile.env}
zheng-ui.version=${zheng-ui.version}
### activeMq
AvtiveMQ.brokerURL=${AvtiveMQ.brokerURL}

View File

@ -0,0 +1,4 @@
403=Access forbidden!
404=Page not found!
500=Internal server error!
error=Server error!

View File

@ -0,0 +1,4 @@
403=\u6CA1\u6709\u6743\u9650\uFF01
404=\u9875\u9762\u6CA1\u6709\u627E\u5230\uFF01
500=\u5185\u90E8\u670D\u52A1\u5668\u9519\u8BEF\uFF01
error=\u670D\u52A1\u5668\u53D1\u751F\u9519\u8BEF\uFF01

View File

@ -0,0 +1,11 @@
#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

View File

@ -0,0 +1,4 @@
profile.env=dev
zheng-ui.version=1.0.0
### activeMq
AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

View File

@ -0,0 +1,4 @@
profile.env=pre
zheng-ui.version=1.0.0
### activeMq
AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

View File

@ -0,0 +1,4 @@
profile.env=prod
zheng-ui.version=1.0.0
### activeMq
AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

View File

@ -0,0 +1,4 @@
profile.env=test
zheng-ui.version=1.0.0
### activeMq
AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

View File

@ -0,0 +1,14 @@
<?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">
<!-- 根目录'/'对应页面 -->
<mvc:view-controller path="/" view-name="/index"/>
</beans>

View File

@ -0,0 +1,21 @@
<%@ 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="403"/></title>
</head>
<body>
<% Exception e = (Exception)request.getAttribute("ex"); %>
<h2>错误: <%= e.getClass().getSimpleName()%></h2>
<hr />
<h5>错误描述:</h5>
<%= e.getMessage()%>
</body>
</html>

View File

@ -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>

View File

@ -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><spring:message code="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>

View File

@ -0,0 +1,25 @@
<%@ 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="error"/></title>
</head>
<body>
<% Exception e = (Exception)request.getAttribute("ex"); %>
<h2>错误: <%= e.getClass().getSimpleName()%></h2>
<hr />
<h5>错误描述:</h5>
<%= e.getMessage()%>
<h5>错误信息:</h5>
<pre>
<% e.printStackTrace(new java.io.PrintWriter(out)); %>
</pre>
</body>
</html>

View File

@ -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>
<a href="${basePath}/manage/index">后台首页</a>
</body>
</html>

View File

@ -0,0 +1,108 @@
<?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>
<!-- zhang-upms-client -->
<filter>
<filter-name>zheng-upms-client</filter-name>
<filter-class>com.zheng.upms.client.filter.SSOFilter</filter-class>
<!-- 系统名称 -->
<init-param>
<param-name>system_name</param-name>
<param-value>zheng-cms-admin</param-value>
</init-param>
<!-- SSO认证中心 -->
<init-param>
<param-name>sso_server_url</param-name>
<param-value>http://upms.zhangshuzheng.cn:1111</param-value>
</init-param>
<!-- 开发模式 -->
<init-param>
<param-name>sso_debug</param-name>
<param-value>false</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>zheng-upms-client</filter-name>
<url-pattern>/manage/*</url-pattern>
</filter-mapping>
<!-- session配置 -->
<session-config>
<session-timeout>30</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>403</error-code>
<location>/WEB-INF/jsp/403.jsp</location>
</error-page>
<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>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/WEB-INF/jsp/error.jsp</location>
</error-page>
</web-app>