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,如需转载请自行联系原作者

目录
相关文章
|
2月前
|
缓存 前端开发 Java
Spring MVC 面试题及答案整理,最新面试题
Spring MVC 面试题及答案整理,最新面试题
97 0
|
2月前
ssm(Spring+Spring mvc+mybatis)——updateDept.jsp
ssm(Spring+Spring mvc+mybatis)——updateDept.jsp
11 0
|
2月前
ssm(Spring+Spring mvc+mybatis)——showDept.jsp
ssm(Spring+Spring mvc+mybatis)——showDept.jsp
9 0
|
2月前
|
SQL JavaScript Java
springboot+springm vc+mybatis实现增删改查案例!
springboot+springm vc+mybatis实现增删改查案例!
26 0
|
2月前
|
SQL Java 数据库连接
挺详细的spring+springmvc+mybatis配置整合|含源代码
挺详细的spring+springmvc+mybatis配置整合|含源代码
45 1
|
8天前
|
前端开发 Java PHP
信息系统架构模型(1) MVC
信息系统架构模型(1) MVC
13 0
|
13天前
|
负载均衡 Java 开发者
细解微服务架构实践:如何使用Spring Cloud进行Java微服务治理
【4月更文挑战第17天】Spring Cloud是Java微服务治理的首选框架,整合了Eureka(服务发现)、Ribbon(客户端负载均衡)、Hystrix(熔断器)、Zuul(API网关)和Config Server(配置中心)。通过Eureka实现服务注册与发现,Ribbon提供负载均衡,Hystrix实现熔断保护,Zuul作为API网关,Config Server集中管理配置。理解并运用Spring Cloud进行微服务治理是现代Java开发者的关键技能。
|
18天前
|
数据采集 前端开发 Java
数据塑造:Spring MVC中@ModelAttribute的高级数据预处理技巧
数据塑造:Spring MVC中@ModelAttribute的高级数据预处理技巧
23 3
|
18天前
|
存储 前端开发 Java
会话锦囊:揭示Spring MVC如何巧妙使用@SessionAttributes
会话锦囊:揭示Spring MVC如何巧妙使用@SessionAttributes
14 1
|
18天前
|
前端开发 Java Spring
数据之桥:深入Spring MVC中传递数据给视图的实用指南
数据之桥:深入Spring MVC中传递数据给视图的实用指南
31 3

热门文章

最新文章