两个和具体业务关联不紧的模块,单独记录。有的项目可能不需要这两个模块

05模块:p2p-pay

该模块专门用来统一各种支付实现,比如Alipay、微信支付等

com.bjpowernode.pay顶级包

com.bjpowernode.pay.config  Alipay的配置类

com.bjpowernode.pay.web  存放控制器类,接收请求并处理

resources存放配置文件

applicationContext.xml  主要:导入 spring mvc 配置

applicationContext-mvc.xml  主要:dispatcherServlet 截获所有 URL 请求   spring mvc 扫描包下的 controller    配置注解驱动    配置视图解析器

log4j.properties   主要:log4j的配置

WEB_INF下的配置文件:

web.xml

配置文件的内容:

applicationContext.xml的配置内容:

<?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:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd"> <!-- 导入 spring mvc 配置 -->
<import resource="applicationContext-mvc.xml" />
</beans>

applicationContext-mvc.xml 的配置内容:

<?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:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
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/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd"> <!-- dispatcherServlet 截获所有 URL 请求 -->
<mvc:default-servlet-handler/> <!-- spring mvc 扫描包下的 controller -->
<context:component-scan base-package="com.bjpowernode.pay.web"/> <!-- 配置注解驱动 -->
<mvc:annotation-driven/> <!-- 配置视图解析器 -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/"/>
<property name="suffix" value=".jsp"/>
</bean> </beans>

log4j.properties的配置内容:

log4j.rootLogger = info, stdout, file
### 输出到控制台 ###
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target = System.out
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = [pay] %d{ABSOLUTE} %5p %c{1}:%L - %m%n log4j.appender.file = org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.File = /opt/pay/logs/log.log
log4j.appender.file.Append = true
log4j.appender.file.Threshold = debug
log4j.appender.file.layout = org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern = [pay] %-d{yyyy-MM-dd HH:mm:ss} [ %c{1} ] - [ %p ] %m%n

web.xml配置文件内容:

<?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"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<!-- 应用名 -->
<display-name>pay</display-name>
<!-- 字符过滤器,字符编码UTF-8 -->
<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>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!-- Spring mvc分发servlet -->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

pom.xml配置内容:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>p2p-parent</artifactId>
<groupId>com.bjpowernode.p2p</groupId>
<version>1.0.0</version>
<relativePath>../p2p-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion> <artifactId>p2p-pay</artifactId>
<packaging>war</packaging> <dependencies> <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
</dependency> <!-- servlet及jstl标签库依赖的JAR配置 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
</dependency> <!-- 加载jackson包 -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency> <!-- commons-logging依赖的JAR配置start -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency> <!-- Log4j的配置start -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency> <dependency>
<groupId>com.bjpowernode.p2p</groupId>
<artifactId>p2p-common</artifactId>
<version>1.0.0</version>
</dependency>
<!--引入非本地仓库的依赖-->
<dependency>
<groupId>com.alipay.api</groupId>
<artifactId>alipay-sdk-java</artifactId>
<version>20170324180803</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/alipay-sdk-java20170324180803.jar</systemPath>
</dependency> <!--wxpay-sdk-->
<dependency>
<groupId>com.github.wxpay</groupId>
<artifactId>wxpay-sdk</artifactId>
<version>0.0.3</version>
</dependency> <dependency>
<groupId>com.bjpowernode</groupId>
<artifactId>HttpClient</artifactId>
<version>1.0.0</version>
</dependency> </dependencies> </project>

06模块:p2p-timer

该模块执行一些定时的任务

新建模块,继承自parent模块,选择maven的webapp模板,该模块是web项目

com.bjpowernode.p2p  顶级包

com.bjpowernode.p2p.timer  放具体执行定时任务的类

resources配置文件

applicationContext.xml  主要:导入 spring task 配置   导入服务提供者配置

applicationContext-dubbo-consumer.xml  主要:配置应用名称   配置注册中心   引用服务提供者暴露的服务

applicationContext-task.xml  主要:自动扫描的包名

log4j.properties  主要:配置log4j配置

WEB_INF下配置文件

web.xml

applicationContext.xml配置文件内容:

<?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:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd"> <!-- 导入 spring task 配置 -->
<import resource="applicationContext-task.xml" />
<!-- 导入服务提供者配置 -->
<import resource="applicationContext-dubbo-consumer.xml"/>
</beans>

applicationContext-dubbo-consumer.xml 配置文件内容:

<?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="p2p"/> <!-- 配置注册中心 -->
<dubbo:registry protocol="zookeeper" address="192.168.127.128:2181"/> <!--产品业务-->
<dubbo:reference id="loanInfoService" interface="com.bjpowernode.p2p.service.loan.LoanInfoService" version="1.0.0" check="false"></dubbo:reference> <!--用户业务-->
<dubbo:reference id="userService" interface="com.bjpowernode.p2p.service.loan.UserService" version="1.0.0" check="false"></dubbo:reference> <!--投资业务-->
<dubbo:reference id="bidInfoService" interface="com.bjpowernode.p2p.service.loan.BidInfoService" version="1.0.0" check="false"></dubbo:reference> <!--帐户业务-->
<dubbo:reference id="financeAccountService" interface="com.bjpowernode.p2p.service.user.FinanceAccountService" version="1.0.0" check="false"></dubbo:reference> <!--redis业务-->
<dubbo:reference id="redisService" interface="com.bjpowernode.p2p.service.loan.RedisService" version="1.0.0" check="false"></dubbo:reference> <!--收益业务-->
<dubbo:reference id="incomeRecordService" interface="com.bjpowernode.p2p.service.loan.IncomeRecordService" version="1.0.0" check="false"></dubbo:reference> <!--充值业务-->
<dubbo:reference id="rechargeRecordService" interface="com.bjpowernode.p2p.service.loan.RechargeRecordService" version="1.0.0" timeout="15000"></dubbo:reference> </beans>

applicationContext-task.xml配置文件内容:

<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd "> <!-- 自动扫描的包名 -->
<context:component-scan base-package="com.bjpowernode.p2p.timer"/> <task:annotation-driven/>
</beans>

log4j.properties配置内容:

log4j.rootLogger = info, stdout, file
### 输出到控制台 ###
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target = System.out
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = [timer] %d{ABSOLUTE} %5p %c{1}:%L - %m%n log4j.appender.file = org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.File = /opt/task/timer/logs/log.log
log4j.appender.file.Append = true
log4j.appender.file.Threshold = debug
log4j.appender.file.layout = org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern = [timer] %-d{yyyy-MM-dd HH:mm:ss} [ %c{1} ] - [ %p ] %m%n

web.xml配置内容:

<?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"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="dataservice" version="3.0">
<display-name>timer application</display-name>
<!-- spring监听器加载applicationContext.xml配置文件 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>

00-B-springmvc分布式项目项目结构的更多相关文章

  1. SpringMVC+Spring+mybatis项目从零开始--分布式项目结构搭建

    转载出处: SpringMVC+Spring+mybatis+Redis项目从零开始--分布式项目结构搭建 /** 本文为博主原创文章,如转载请附链接. **/ SSM框架web项目从零开始--分布式 ...

  2. 00-A-springmvc分布式项目项目结构

    项目使用IDEA进行开发 一个分布式项目基本需要的模块. 用到的技术spring+springmvc+mybatis+dubbo +mysql+redis 01模块名字:p2p-parent 作为父模 ...

  3. SpringMVC+Maven开发项目源码详细介绍

    代码地址如下:http://www.demodashi.com/demo/11638.html Spring MVC概述 Spring MVC框架是一个开源的Java平台,为开发强大的基于Java的W ...

  4. Xbin-Store(分布式商城)项目所用Linux服务系列 FastDFS安装(五)

    系列 Xbin-Store(分布式商城)项目所用Linux服务系列 MySQL安装(一) Xbin-Store(分布式商城)项目所用Linux服务系列 Redis集群安装(二) Xbin-Store( ...

  5. springmvc+spring+mybatis 项目配置

    前提 工作环境:JDK 1.8.Mysql 5.7.18.Intellij IDEA 2018.1.Tomcat 8.5.Maven 框架版本:Spring 4.2.0.RELEASE.SpringM ...

  6. SpringMvc 整合mybatis项目搭建

    1.使用idea创建maven项目 2.在项目src目录下 添加java文件夹 并设置类型为sources,添加resource文件夹 设置为resources 4.修改pom文件 添加引用 < ...

  7. express+gulp构建项目(一)项目目录结构

    express是基于nodejs平台的web框架,它可以让我们快速开发出web引用.而gulp是一种自动构建工具,非常强大,有了它,能帮我们完成很多繁琐的工作,例如,静态文件的压缩,为静态文件加上哈希 ...

  8. Laravel项目目录结构说明

    Laravel项目目录结构说明: |- vendor 目录包含你的 Composer 依赖模块及laravel框架. |- bootstrap 目录包含几个框架启动跟自动加载配置的文件. |- app ...

  9. 【dubbo】dubbo项目基本结构及provider构建

    dubbo项目基本结构如下,分别部署于不同服务器: 1.provider(接口API 实现) 2.consumer(web) 3.zookeeper 4.DB provider构建 1.api构建 i ...

  10. MVVM 模式下iOS项目目录结构详细说明

    ➠更多技术干货请戳:听云博客 我们在做项目的时候,会经常用到各种设计模式,最常见的要数 MVC (模型,视图,控制器)了.但是,今天我们要说的是另一种设计模式——MVVM. 所以 MVVM 到底是什么 ...

随机推荐

  1. 六十八:flask上下文之app上下文和request上下文

    app上下文: 先看现象 current_app源码 手动入栈 app_context()源码 with语句入栈 request上下文 不在app上下文中 即使手动入栈也会报错,不在请求上下文中 ur ...

  2. python常见报错

    1.Pycharm No module named requests 的解决方法 pip install requests 然后重启pycharm

  3. DevOps - Scrum

    1 - DevOps与敏捷开发 在采用敏捷开发的情况下,所有成员都对服务和产品负责,理解彼此的业务,符合DevOps的组织和文化. 以商业需求为核心,在较短期间内确定开发方针,并持续进行改善,从而逐步 ...

  4. <转>常规测试方法

    功能测试 1. 安装测试: 安装过程中对于缺省安装目录及任意指定的安装目录,是否都能正确安装: 若是选择安装,查看能否实现其相应的功能: 在所有能中途退出安装的位置退出安装程序后,验证此程序并未安装成 ...

  5. python网络应用篇

    正则表达式 import re #引入正则表达式模块  使用re.match/search函数进行匹配(区别:match只匹配字符串的开始,如果不符合正则表达式,则匹配失败,返回None,而searc ...

  6. 配置中心 Spring Cloud config

    配置管理工具包,让你可以把配置放到远程服务器,集中化管理集群配置,目前支持本地存储.Git以及Subversion. 1.服务端 创建spring boot 项目 主要依赖 <dependenc ...

  7. 自然语言处理NLP学习笔记二:NLP实战-开源工具tensorflow与jiagu使用

    前言: NLP工具有人推荐使用spacy,有人推荐使用tensorflow. tensorflow:中文译作:张量(超过3维的叫张量)详细资料参考:http://www.tensorfly.cn/ J ...

  8. 【C++ 学习笔记】 MFC CEdit

    环境:VS2008 -关联变量 方法一:在控件上右键-变量-CEdit类型变量-输入变量名. 方法二:添加代码 头文件中定义变量CEdit m_edit_fileName; 源文件中变量关联DDX_C ...

  9. PTA(Basic Level)1041.考试座位号

    每个 PAT 考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位.正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考 ...

  10. Python学习【day04】- Python基础(集合、函数)

    集合 #!/usr/bin/env python # -*- coding:utf8 -*- # set集合 只可放不可变的数据类型,本身是可变数据类型,无序 # s = {1,2,3,[1,2,3] ...