SpringSide 并不热衷将第三方类库又重新包装一次,能用原生API的地方尽量就用了。所以目前Modules中的内容极少。

1. Core

     Core Modules是最常用的封装。包括:

  • ORM:Dao泛型基类。
  • 测试:包括Spring集成测试类的扩展,分组测试的支持,Selenium的支持。
  • 日志:包括 MockLog4jAppender, Log4jMBean
  • 工具类:包括 SpringContextHolder与SpringSecurity, Servlet与Struts2,  反射,xml/json/base64/hex编码的工具类。

2.Extension

     Extension Module 是mini-xxx示例中使用不上的封装。

  • Memcached/TokyoTyrant : 客户端与本地开发的服务模拟器。
  • Security: JCaptcha验证码集成;SpringSecurity与CXF集成; 加解密, 散列生成Utils.
  • 工具类:JmxClientTemplate。

3.Parent

     可重用的pom.xml主文件,可简化各子项目中pom.xml文件的定义。

3.1 基本定义

  • <properties> 属性定义,包括依赖库的版本号与plugin属性的定义。
  • <repositories> 和<pluginRepositories> 设定除中央仓库(repo1.maven.org/maven2/)外的其他Jar仓库。设定先找团队本地Nexus私服,再找中央仓库,最后找 JBoss, Sun等其他仓库。

3.2 依赖项版本预定义

  • <dependencyManagement>定义全部依赖项的默认version,scope 和exclusion,则子POM 只需定义groupId 和 artifactId 即可. (type不为jar时需重新定义type)。
  • <dependencyManagement>不会产生实际的依赖,仅当子类定义depency时才生效.

3.3 Build/Plugins 定义

       定义了一些plugin的最新版本,并作了以下设置

  • 指定 maven-compiler-plugin,按JDK6.0语法编译。
  • 指定 maven-resource-plugin, 复制resource文件时编码根据公共属性${project.build.sourceEncoding}定义。
  • 指定 maven-war-plugin,生成的war文件名为artifactId.war,不带version信息.
  • 指定 maven-jar-plugin, 定义META-INF的内容.
  • 指定 maven-eclipse-plugin, 定义exclude .svn文件,生成项目时下载source code。
  • 指定 maven-jetty-plugin, 定义在屏幕中按回车重载应用。

4. SpringSide Modules的使用

  在springside-core与springside-extension中点击install.bat安装到本地仓库,然后在项目的pom.xml中依赖它们。

  但其实所有的基类都可以拆开来,随便修改成用户自己喜欢的样子,然后重命名为自己项目的基类,而不必完整的依赖springside-core,大家的修改不存在任何的版权问题:)

posted on 2010-12-17 16:19 hello 阅读(329) 评论(0)  编辑  收藏 所属分类: springside