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

目录
相关文章
|
11月前
|
监控 Java API
Spring Boot 3.2 结合 Spring Cloud 微服务架构实操指南 现代分布式应用系统构建实战教程
Spring Boot 3.2 + Spring Cloud 2023.0 微服务架构实践摘要 本文基于Spring Boot 3.2.5和Spring Cloud 2023.0.1最新稳定版本,演示现代微服务架构的构建过程。主要内容包括: 技术栈选择:采用Spring Cloud Netflix Eureka 4.1.0作为服务注册中心,Resilience4j 2.1.0替代Hystrix实现熔断机制,配合OpenFeign和Gateway等组件。 核心实操步骤: 搭建Eureka注册中心服务 构建商品
1468 3
|
JavaScript 前端开发 Java
垃圾分类管理系统基于 Spring Boot Vue 3 微服务架构实操指南
本文介绍了基于Java技术的垃圾分类管理系统开发方案与实施案例。系统采用前后端分离架构,后端使用Spring Boot框架搭配MySQL数据库,前端可选择Vue.js或Java Swing实现。核心功能模块包括垃圾分类查询、科普教育、回收预约等。文中提供了两个典型应用案例:彭湖花园小区使用的Swing桌面系统和基于Spring Boot+Vue的城市管理系统,分别满足不同场景需求。最新技术方案升级为微服务架构,整合Spring Cloud、Redis、Elasticsearch等技术,并采用Docker容器
684 1
|
9月前
|
监控 Cloud Native Java
Spring Boot 3.x 微服务架构实战指南
🌟蒋星熠Jaxonic,技术宇宙中的星际旅人。深耕Spring Boot 3.x与微服务架构,探索云原生、性能优化与高可用系统设计。以代码为笔,在二进制星河中谱写极客诗篇。关注我,共赴技术星辰大海!(238字)
1357 2
Spring Boot 3.x 微服务架构实战指南
|
10月前
|
Java 数据库 数据安全/隐私保护
Spring Boot四层架构深度解析
本文详解Spring Boot四层架构(Controller-Service-DAO-Database)的核心思想与实战应用,涵盖职责划分、代码结构、依赖注入、事务管理及常见问题解决方案,助力构建高内聚、低耦合的企业级应用。
1750 1
|
10月前
|
Kubernetes Java 微服务
Spring Cloud 微服务架构技术解析与实践指南
本文档全面介绍 Spring Cloud 微服务架构的核心组件、设计理念和实现方案。作为构建分布式系统的综合工具箱,Spring Cloud 为微服务架构提供了服务发现、配置管理、负载均衡、熔断器等关键功能的标准化实现。本文将深入探讨其核心组件的工作原理、集成方式以及在实际项目中的最佳实践,帮助开发者构建高可用、可扩展的分布式系统。
802 0
|
Java 开发者 微服务
从单体到微服务:如何借助 Spring Cloud 实现架构转型
**Spring Cloud** 是一套基于 Spring 框架的**微服务架构解决方案**,它提供了一系列的工具和组件,帮助开发者快速构建分布式系统,尤其是微服务架构。
2703 70
从单体到微服务:如何借助 Spring Cloud 实现架构转型
|
12月前
|
存储 Java 数据库连接
简单学Spring Boot | 博客项目的三层架构重构
本案例通过采用三层架构(数据访问层、业务逻辑层、表现层)重构项目,解决了集中式开发导致的代码臃肿问题。各层职责清晰,结合依赖注入实现解耦,提升了系统的可维护性、可测试性和可扩展性,为后续接入真实数据库奠定基础。
836 0

推荐镜像

更多