云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 毕业论文外文翻译-Spring 框架简介

毕业论文外文翻译-Spring 框架简介

  • 62 次阅读
  • 3 次下载
  • 2025/5/24 9:03:05

root factory. From the point of view of a caller, all factories in such a hierarchy will appear to be merged into one. Bean definitions in ancestor contexts are visible to descendant contexts, but not the reverse.

All exceptions thrown by the BeanFactory interface and sub-interfaces extend org.springframework. beans.BeansException, and are unchecked. This reflects the fact that low-level configuration prob-lems are not usually recoverable: Hence, application developers can choose to write code to recover from such failures if they wish to, but should not be forced to write code in the majority of cases where config-uration failure is fatal.

Most implementations of the BeanFactory interface do not merely provide a registry of objects by name; they provide rich support for configuring those objects using IoC. For example, they manage dependen-cies between managed objects, as well as simple properties. In the next section, we’ll look at how such configuration can be expressed in a simple and intuitive XML structure.

The

sub-interface

org.springframework.beans.factory.ListableBeanFactory supports listing beans in a factory. It provides methods to retrieve the number of beans defined, the names of all beans, and the names of beans that are instances of a given type:

public interface ListableBeanFactory extends BeanFactory { int getBeanDefinitionCount(); String[] getBeanDefinitionNames();

String[] getBeanDefinitionNames(Class type); boolean containsBeanDefinition(String name);

13

Map getBeansOfType(Class type, boolean includePrototypes, boolean includeFactoryBeans) throws BeansException }

The ability to obtain such information about the objects managed by a ListableBeanFactory can be used to implement objects that work with a set of other objects known only at runtime.

In contrast to the BeanFactory interface, the methods in ListableBeanFactory apply to the current factory instance and do not take account of a hierarchy that the factory may be part of. The org.spring framework.beans.factory.BeanFactoryUtils class provides analogous methods that traverse an entire factory hierarchy.

There are various ways to leverage a Spring bean factory, ranging from simple bean configuration to J2EE resource integration and AOP proxy generation. The bean factory is the central, consistent way of setting up any kind of application objects in Spring, whether DAOs, business objects, or web controllers. Note that application objects seldom need to work with the BeanFactory interface directly, but are usu-ally configured and wired by a factory without the need for any Spring-specific code.

For standalone usage, the Spring distribution provides a tiny spring-core.jar file that can be embed-ded in any kind of application. Its only third-party dependency beyond J2SE 1.3 (plus JAXP for XML parsing) is the Jakarta Commons Logging API.

The bean factory is the core of Spring and the foundation for many other services that the framework offers. Nevertheless, the bean factory can easily be used stan-dalone if no other Spring services are required.

Derivative:network

Spring 框架简介

14

Spring框架:这是一个流行的开源应用框架,它可以解决很多问题。这里主要介绍Spring的基本概念,并详细介绍其中以“bean工厂”为核心的轻量级控制反转(IoC)容器。

Spring让开发者更轻松的实现轻量级、可扩展的J2EE架构。对于我们推荐的架构模块,让Spring提供了即时可用的实现。此外,Spring还提供了同意的应用架构方式,以及大量的中间层功能模块,能大大简化了J2EE的开发,并且比传统的开发方式更加灵活。

第一章:Spring项目的出发点

1.1解决被其它框架忽略的部分

在J2EE的各个具体领域都有很多出色的解决方案----web框架、持久化方案、远程调用工具,凡此种种。然而,将这些工具整合成一个全面的架构却困难重重,甚至成为一种负担。Spring的目标就是提供一种贯穿始终的解决方案,将各种专用框架整合成一个连贯的整体架构。Spring还涉及到其它框架没有触及到的地方。例如,很少有框架提供普遍适用的事务管理或是数据库存储对象实现;即便各个领域都有很好的选择,也没有一个框架能够帮忙把所有这些东西整合到一个应用中去。因此,我们说Spring是一个应用框架,而不是web框架、IoC框架、AOP框架或者中间层框架什么的。

1.2易于选择

一个框架应该有清楚的层次划分,允许用户使用其中的单项功能,而不是把自己的整个世界观强加给用户。Spring中的许多特性---例如JDBC抽象层或者Hibernation集成----都可以作为一个库单独使用,当然也可以作为Spring整体方案的一个部分。

1.3易于使用

正如前面说过的,仅仅J2EE本身并不易用---很多常见的问题光靠J2EE都很难解决。一个好的基础框架首先应该让容易的任务容易完成,而不需要让应用开发人员现在就为将来的复杂需求(例如分布式事务)买单。框架应该帮助开发人员合理使用J2EE的服务(例如JTA),同时又避免造成对服务的依赖,从而减少不必要的复杂性。

15

1.4 鼓励最佳实现

Spring力求把遵循最佳实践--例如“针对接口编程”--的成本降低到最小。另一方面,Spring又力求不强加任何架构风格,而是把选择的权利留给开发者。

1.5 非入侵性

一个好的基础设施框架应保持应用组态灵活和一致,避免自定义单身和工厂的需要。一个单一的风格应该是适用于所有配置的需要,从中间层的网络控制器。

1.6 统一配置

测试整个应用程序或单个应用程序类的单元测试应该尽可能的容易。模仿对象替换资源或应用程序的对象应该是简单的。

1.7 可扩展

由于Spring本身是基于接口的,而不是类,它是很容易扩展或定制。许多Spring组件使某种形式的Strategy模式,因此可以方便定制。

第二章:一个分层的应用框架

前面我们从轻量级容器(lightwight container)的角度介绍了Spring框架,并将其与别的IoC容器(例如PicoContainer) 作了比较。虽然为JavaBean设计的轻量级容器是Spring的核心概念,但这也只是所有中间层解决方案的基础而已。

2.1 基础构建模块

Spring是一个完整的应用框架,它可以在很懂应用层发挥作用。Spring由多个子框架组成,而且这些框架都是相对独立的。不过,只要你愿意,你就可以将它们无缝集成起来,成为一个全面的应用框架,下面讲解Spring框架的关键概念。

2.1.1 bean工厂

Spring轻量级IoC容器能够配置、装备JavaBean和大多数Java对象,使得开发者不必定制Singleton和自己的配置机制。Spring提供了多个“即拿即用”的bean工厂实现。其中包括一个基于XML的bean工厂。轻量级IoC容器和依赖注入(Dependency Injcction)将是本章节关注的内容。 2.1.2应用上下文

16

搜索更多关于: 毕业论文外文翻译-Spring 框架简介 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

root factory. From the point of view of a caller, all factories in such a hierarchy will appear to be merged into one. Bean definitions in ancestor contexts are visible to descendant contexts, but not the reverse. All exceptions thrown by the BeanFactory interface and sub-interfaces extend org.springframework. beans.BeansException, and are unchecked. This reflects the fact that l

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com