1.持久層web
(1) 域模型層spring
(2) Dao 持久層接口app
(3) DaoImpl 持久層接口實現url
2.業務層spa
Service 業務接口層code
ServiceImpl 業務接口實現 xml
3.展示層blog
Spring 2.5 新增基於註解的MVC , SPring 3.0 中提供Rest風格的MVC.接口
首先 須要對 web.xml 文件配置 ,以便 Web 容器啓動時可以自動啓動 Spring 容器.servlet
<!-- 從類路徑下加載Spring配置文件,param-value指定 加載路徑,classpath關鍵字特指類路徑下加載 --> <Context-param> <param-name>ContextConfigLocation</param-name> <param-value>classpath:applicationContext.xml</param-value> </Context-param> <!-- 負責啓動Spring容器的監聽器 ,他將引用上面的上下文參數得到Spring配置文件地址 --> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener>
Spring MVC 的地址映射
<!-- Spring MVC 的主控Servlet --> <servlet> <servlet-name></servlet-name> <servlet-class></servlet-class> <load-on-startup></load-on-startup> </servlet> <servlet-mapping> <servlet-name></servlet-name> <url-pattern></url-pattern> </servlet-mappging>