MESSL(maven + extjs + spring portlet mvc + spring web flow + liferay )整合架构 2

简介:

因为这是个基于spring的web应用,所以当然我们从web.xml看起:

1
<? xml  version = "1.0"  encoding = "ISO-8859-1" ?> < web-app  xmlns = "http://java.sun.com/xml/ns/j2ee"      xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"      xsi:schemaLocation = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"      version = "2.4" >       <!--       - Location of the XML file that defines the root application context       - Applied by ContextLoaderListener.       -->      < context-param >         < param-name >contextConfigLocation</ param-name >         < param-value >             /WEB-INF/config/application-config.xml         </ param-value >     </ context-param >       <!--       - Loads the root application context of this web app at startup.       - The application context is then available via       - WebApplicationContextUtils.getWebApplicationContext(servletContext).     -->      < listener >         < listener-class >org.springframework.web.context.ContextLoaderListener</ listener-class >     </ listener >          < servlet >         < servlet-name >ViewRendererServlet</ servlet-name >         < servlet-class >org.springframework.web.servlet.ViewRendererServlet</ servlet-class >     </ servlet >          < servlet-mapping >         < servlet-name >ViewRendererServlet</ servlet-name >         < url-pattern >/WEB-INF/servlet/view</ url-pattern >     </ servlet-mapping >        </ web-app >

在第23-25行表示了我们进入spring框架,这个大家都知道。

 

在第11-16行,定义了Spring的配置文件,我当时设计时候,还是采用了多配置文件结构,所以在应用层,我只指定了这1个配置文件,这个配置文件定义了Spring应用的一些宏观的内容:

这个文件在/WEB-INF/config/applicatino-config.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:tx="http://www.springframework.org/schema/tx"        xsi:schemaLocation="http://www.springframework.org/schema/beans            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd            http://www.springframework.org/schema/context            http://www.springframework.org/schema/context/spring-context-3.0.xsd" >                 <!-- Activates annotation-based bean configuration -->     <context:annotation-config />          <!-- Scans for application @Components to deploy to spring container -->     <context:component-scan base-package="xx.xx.xx.handlers" />     <context:component-scan base-package="xx.xx.xx.service.impl" />     <context:component-scan base-package="xx.xx.xx.portlet" />      </beans>

我这里只开启了注解配置,并且启用了java包扫描,所以被我罗列的包中的所有Spring注解都会被扫描到,并且在Spring Application Context加载时自动实例化对应的被标注的 bean.





本文转自 charles_wang888 51CTO博客,原文链接:http://blog.51cto.com/supercharles888/1138827,如需转载请自行联系原作者

目录
相关文章
|
1月前
|
JSON 前端开发 Java
spring mvc Rest风格
spring mvc Rest风格
20 0
|
17天前
|
前端开发 Java 应用服务中间件
我以为我对Spring MVC很了解,直到我遇到了...
所有人都知道Spring MVC是是开发的,却鲜有人知道Spring MVC的理论基础来自于1978 年提出MVC模式的一个老头子,他就是Trygve Mikkjel Heyerdahl Reenskaug,挪威计算机科学家,名誉教授。Trygve Reenskaug的MVC架构思想早期用于图形用户界面(GUI) 的软件设计,他对MVC是这样解释的。MVC 被认为是解决用户控制大型复杂数据集问题的通用解决方案。最困难的部分是为不同的架构组件想出好的名字。模型-视图-编辑器是第一个。
我以为我对Spring MVC很了解,直到我遇到了...
|
26天前
|
前端开发 Java Spring
Spring MVC中使用ModelAndView传递数据
Spring MVC中使用ModelAndView传递数据
|
26天前
|
JavaScript Java Maven
理解固化的Maven依赖:spring-boot-starter-parent 与 spring-boot-dependencies
理解固化的Maven依赖:spring-boot-starter-parent 与 spring-boot-dependencies
159 1
|
1月前
|
安全 前端开发 Java
挑战5分钟内基于Springboot+SpringMVC+Mybatis-plus快速构建web后端三层架构
挑战5分钟内基于Springboot+SpringMVC+Mybatis-plus快速构建web后端三层架构
32 1
|
19天前
|
XML 前端开发 Java
Spring Boot与Spring MVC的区别和联系
Spring Boot与Spring MVC的区别和联系
序-Servlet和SpringMVC的联系和区别-配置路径先想好使用的使用的方法,然后匹配的需要的技术
序-Servlet和SpringMVC的联系和区别-配置路径先想好使用的使用的方法,然后匹配的需要的技术
|
1月前
|
JSON 前端开发 数据格式
SpringMVC的数据响应-直接回写json字符串
SpringMVC的数据响应-直接回写json字符串
|
1月前
|
XML 前端开发 Java
SpringMVC的架构有什么优势?——异常处理与文件上传(五)
SpringMVC的架构有什么优势?——异常处理与文件上传(五)
|
1月前
|
前端开发 Java API
SpringMVC的架构有什么优势?——控制器(三)
SpringMVC的架构有什么优势?——控制器(三)

推荐镜像

更多