上一篇我们介绍《构建dubbo分布式平台-maven构建ant-config项目》,框架使用maven进行构建,根据我们的规划,要将子项目全部构建出来,今天重点讲解的是ant-framework可信项目的构建过程。
其中ant-framework是ant分布式框架的基础核心框架,其中包括CRUD,MVC等一系列基类和模板。另外定义了spring,mybatis,wink等底层框架扩展项目,具体内容包括:
- annotation相关注解:数据签名注解、用户是否走sso登录注解等;
- Bean的相关认证;
- filter过滤器:分页、sso单点登录等;
- 对象转换封装,如:json;
- 基础controller、dao、service、basebean、xml的封装;
- security权限的封装;
- 基础CRUD的封装;
- 基础servlet的封装;
- 通用管理的封装,如:用户、角色、权限、数据字典、菜单、日子、部门机构等。
提示:当前只列了其中的一小部分核心,在后面的章节中会将所有涉及的内容一一讲解且附上相关代码。
前面的文章我一次写的内容有点多,有些学者可能一下无法接受的了,在后面的章节中,我会针对于每一个知识点进行详细剖析,希望大家能够按照实例将框架搭建起来。
今天我们只做简单的项目创建,创建ant-framework项目,并继承ant-parent项目,其中pom.xml配置文件如下:
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.sml.sz</groupId>
<artifactId>ant-project</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>ant-framework</artifactId>
<name>ant-framework</name>
<url>http://maven.apache.org</url>
<description>此项目定义了ant的代码框架,包括CRUD,MVC等一系列基类和模板。另外定义了spring,mybatis,wink等底层框架扩展</description>
<dependencies>
<!-- spring begin -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- spring end -->
<!-- shiro begin -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>${shiro.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<version>${shiro.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- shiro end -->
<!-- mybatis begin -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatis-spring.version}</version>
</dependency>
<!-- mybatis end -->
<!-- hibernate validate begin -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${validator.version}</version>
</dependency>
<!-- hibernate validate end -->
<!-- 框架工具jar包 -->
<dependency>
<groupId>com.sml.sz</groupId>
<artifactId>ant-utils</artifactId>
<exclusions>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
架构代码如下:
原文地址:http://blog.51cto.com/13568887/2071279
时间: 2024-11-09 15:31:55