spring3的JAR包與註解學習筆記

一.spring包分析
web

org.springframework.aop- 3.0.0.RELEASE: 面向切面編程,提供AOP實現。ajax


org.springframework.asm- 3.0.0.RELEASE:獨立的asm程序,Spring2.5.6的時候須要asmJar 包.3.0開始提供他本身獨立的asmJarspring


org.springframework.aspects- 3.0.0.RELEASE:提供對AspectJ框架的整合express


org.springframework.beans- 3.0.0.RELEASE:SpringIoc(依賴注入)的實現編程


org.springframework.context.support- 3.0.0.RELEASE:spring-context的擴展支持,用於MVC方面緩存


org.springframework.context- 3.0.0.RELEASE:Spring提供在基礎IoC功能上的擴展服務,此外還提供許多企業級服務的支持,如郵件服務、任務調度、JNDI定位、EJB集成、遠程訪問、緩存以及各類視圖層框架的封裝等tomcat


org.springframework.core- 3.0.0.RELEASE:Spring的核心工具包服務器


org.springframework.expression- 3.0.0.RELEASE:Spring表達式語言支持包mybatis


org.springframework.instrument.tomcat- 3.0.0.RELEASE:Spring對Tomcat鏈接池的集成mvc


org.springframework.instrument- 3.0.0.RELEASE:Spring對服務器的代理接口


org.springframework.jdbc- 3.0.0.RELEASE:Spring對JDBC的簡單封裝


org.springframework.jms- 3.0.0.RELEASE:封裝JMS API


org.springframework.orm- 3.0.0.RELEASE:整合第三方的ORM框架,如Hibernate,mybatis等


org.springframework.oxm-3.0.0.RELEASE:Spring對Object/XML的映射支持,能夠讓Java與xml以前來回切換。


org.springframework.test- 3.0.0.RELEASE:Spring對Junit測試框架的簡單封裝


org.springframework.transaction- 3.0.0.RELEASE:對JDBC,Hibernate,JDO,JPA等提供的一致的聲明式和編程式事務管理


org.springframework.web.portlet- 3.0.0.RELEASE:SpringMVC的增強支持包


org.springframework.web.servlet- 3.0.0.RELEASE:對Javaee Servlet的支持


org.springframework.web.struts- 3.0.0.RELEASE:提供對整合struts框架的支持


org.springframework.web- 3.0.0.RELEASE:SpringWeb下的工具包


mybatis-spring-1.2.1.jar:Spring整合mybatis時的支持包


二.Springmvc經常使用註解說明

@Controller

在類上面定義,代表該類為控制器,返回字符串與redirect:xxx


@RequestMapping(value="" method=XX)

在類或方法上面使用,表示設置URL訪問地址。它有兩個屬性,value指定訪問路徑,method指定請求方式,請求方式在RequestMethod這個類中,所有以常量的形式定義,它默認使用GET請求。


@RequestParam

指定Request請求參數,在方法參數中定義,至關於傳統的request.getParameter().


@PathVariable

獲取URL訪問路徑變量,這是Springmvc3.0框架才加入的特性,基於Restful風格的URL訪問路徑


@ModelAttribute

全局式的方法,在一組URL訪問路徑中,每次都會執行,方法返回結果保存在module會話中


@Service

在類上面定義,指定被註解的類是業務邏輯組件,若是不指定具體的Bean ID,則採用默認命名方式,即類名的首字母小寫.


@Repository

在DAO層的類上使用


@Autowired

IOC自動注入功能,替換之前的set方法


@Qualifier

對同一接口類有不一樣實現指定具體的實現類


@ResponseBody

定義在方法上,Ajax調用聲明,指定方法返回結果爲Ajax回調函數結果。這是spring3.0新增的特性,用來標識ajax調用。


@InitBinder

初始化數據綁定與類型轉換,將傳入的參數轉換爲自定義類型,或者對參數進行自定義處理。

相關文章
相關標籤/搜索