您好,欢迎光临本网站![请登录][注册会员]  
文件名称: spring-framework-reference 3.1
  所属分类: Java
  开发工具:
  文件大小: 3mb
  下载次数: 0
  上传时间: 2011-09-14
  提 供 者: ti***
 详细说明: Table of Contents I. Overview of Spring Framework ..............................................................................................1 1. Introduction to Spring Framework ..................................................................................2 1.1. Dependency Injection and Inversion of Control ....................................................2 1.2. Modules ............................................................................................................3 Core Container ......................... ........................................................................3 Data Access/Integration ....................................................................................3 Web .................................................................................................................4 AOP and Instrumentation ..................................................................................4 Test .................................................................................................................4 1.3. Usage scenarios .................................................................................................5 Dependency Management and Naming Conventions ...........................................6 Spring Dependencies and Depending on Spring ..........................................8 Maven Dependency Management ..............................................................8 Ivy Dependency Management .................................................................10 Logging .........................................................................................................10 Not Using Commons Logging .................................................................11 Using SLF4J ..........................................................................................11 Using Log4J ...........................................................................................13 II. What's New in Spring 3 ......................................................................................................15 2. New Features and Enhancements in Spring 3.0 .............................................................16 2.1. Java 5 ..............................................................................................................16 2.2. Improved documentation ..................................................................................16 2.3. New articles and tutorials ..................................................................................16 2.4. New module organization and build system .......................................................17 2.5. Overview of new features .................................................................................18 Core APIs updated for Java 5 ..........................................................................19 Spring Expression Language ...........................................................................19 The Inversion of Control (IoC) container ..........................................................20 Java based bean metadata ........................................................................20 Defining bean metadata within components ..............................................21 General purpose type conversion system and field formatting system .................21 The Data Tier .................................................................................................21 The Web Tier .................................................................................................22 Comprehensive REST support .................................................................22 @MVC additions ...................................................................................22 Declarative model validation ...........................................................................22 Early support for Java EE 6 .............................................................................22 Support for embedded databases ......................................................................22 3. New Features and Enhancements in Spring 3.1 .............................................................23 3.1. Overview of new features .................................................................................23 Spring Framework 3.1 Reference Documentation ii Cache Abstraction ..........................................................................................23 Bean Definition Profiles ..................................................................................23 Environment Abstraction ................................................................................23 PropertySource Abstraction .............................................................................23 Code equivalents for Spring's XML namespaces ...............................................24 Builder-style APIs for code-based Hibernate configuration ................................24 TestContext framework support for @Configuration classes and bean definition profiles ..........................................................................................................24 c: namespace for more concise constructor injection .........................................24 Support for injection against non-standard JavaBeans setters .............................24 Support for Servlet 3 code-based configuration of Servlet Container ..................25 Support for Servlet 3 MultipartResolver ...........................................................25 JPA EntityManagerFactory bootstrapping without persistence.xml ....................25 New HandlerMethod-based Support Classes For Annotated Controller Processing .......................................................................................................................25 Consumes and Produces @RequestMapping Conditions ...................................26 Working With URI Template Variables In Controller Methods ..........................26 Validation For @RequestBody Method Arguments ...........................................27 III. Core Technologies ............................................................................................................28 4. The IoC container .......................................................................................................29 4.1. Introduction to the Spring IoC container and beans .............................................29 4.2. Container overview ..........................................................................................29 Configuration metadata ...................................................................................30 Instantiating a container ..................................................................................31 Composing XML-based configuration metadata .......................................33 Using the container .........................................................................................33 4.3. Bean overview .................................................................................................34 Naming beans .................................................................................................35 Aliasing a bean outside the bean definition ...............................................36 Instantiating beans ..........................................................................................37 Instantiation with a constructor ................................................................37 Instantiation with a static factory method .................................................38 Instantiation using an instance factory method ..........................................38 4.4. Dependencies ...................................................................................................40 Dependency injection ......................................................................................40 Constructor-based dependency injection ...................................................40 Setter-based dependency injection ...........................................................42 Dependency resolution process ................................................................43 Examples of dependency injection ...........................................................45 Dependencies and configuration in detail .........................................................47 Straight values (primitives, Strings, and so on) .........................................47 References to other beans (collaborators) .................................................48 Inner beans .............................................................................................49 Collections .............................................................................................50 Null and empty string values ...................................................................52 Spring Framework 3.1 Reference Documentation iii XML shortcut with the p-namespace ........................................................53 XML shortcut with the c-namespace ........................................................54 Compound property names ......................................................................55 Using depends-on ...........................................................................................55 Lazy-initialized beans .....................................................................................56 Autowiring collaborators .................................................................................56 Limitations and disadvantages of autowiring ............................................58 Excluding a bean from autowiring ...........................................................58 Method injection ............................................................................................59 Lookup method injection .........................................................................60 Arbitrary method replacement .................................................................61 4.5. Bean scopes .....................................................................................................62 The singleton scope ........................................................................................63 The prototype scope ........................................................................................64 Singleton beans with prototype-bean dependencies ...........................................65 Request, session, and global session scopes ......................................................65 Initial web configuration .........................................................................65 Request scope .........................................................................................66 Session scope .........................................................................................66 Global session scope ...............................................................................67 Scoped beans as dependencies .................................................................67 Custom scopes ...............................................................................................69 Creating a custom scope ..........................................................................69 Using a custom scope ..............................................................................70 4.6. Customizing the nature of a bean .......................................................................71 Lifecycle callbacks .........................................................................................72 Initialization callbacks ............................................................................72 Destruction callbacks ..............................................................................73 Default initialization and destroy methods ................................................73 Combining lifecycle mechanisms ............................................................75 Startup and shutdown callbacks ...............................................................75 Shutting down the Spring IoC container gracefully in non-web applications 77 ApplicationContextAware and BeanNameAware ..............................................78 Other Aware interfaces ...................................................................................78 4.7. Bean definition inheritance ...............................................................................80 4.8. Container Extension Points ...............................................................................82 Customizing beans using a BeanPostProcessor .................................................82 Example: Hello World, BeanPostProcessor-style ......................................83 Example: The RequiredAnnotationBeanPostProcessor ..............................84 Customizing configuration metadata with a BeanFactoryPostProcessor ..............85 Example: the PropertyPlaceholderConfigurer ...........................................86 Example: the PropertyOverrideConfigurer ...............................................87 Customizing instantiation logic with a FactoryBean ..........................................88 4.9. Annotation-based container configuration ..........................................................89 @Required .....................................................................................................90 Spring Framework 3.1 Reference Documentation iv @Autowired and @Inject ................................................................................91 Fine-tuning annotation-based autowiring with qualifiers ...................................94 CustomAutowireConfigurer ............................................................................99 @Resource ................................................................................................... 100 @PostConstruct and @PreDestroy ................................................................. 101 4.10. Classpath scanning and managed components ................................................ 101 @Component and further stereotype annotations ............................................ 102 Automatically detecting classes and registering bean definitions ...................... 102 Using filters to customize scanning ................................................................ 103 Defining bean metadata within components .................................................... 104 Naming autodetected components .................................................................. 106 Providing a scope for autodetected components .............................................. 107 Providing qualifier metadata with annotations ................................................ 107 4.11. Using JSR 330 standard annotations .............................................................. 108 Dependency Injection with @Inject and @Named .......................................... 109 @Named: a standard equivalent to the @Component annotation ...................... 109 Limitations of the standard approach .............................................................. 110 4.12. Java-based container configuration ................................................................ 111 Basic concepts: @Configuration and @Bean .................................................. 111 Instantiating the Spring container using AnnotationConfigApplicationContext . 111 Simple construction .............................................................................. 112 Building the container programmatically using register(Class...) ........ 112 Enabling component scanning with scan(String...) .................................. 112 Support for web applications with AnnotationConfigWebApplicationContext ............................................................................................................. 113 Composing Java-based configurations ............................................................ 114 Using the @Import annotation ............................................................... 114 Combining Java and XML configuration ................................................ 117 Using the @Bean annotation ......................................................................... 119 Declaring a bean ................................................................................... 119 Injecting dependencies .......................................................................... 120 Receiving lifecycle callbacks ................................................................. 120 Specifying bean scope ........................................................................... 121 Customizing bean naming ..................................................................... 123 Bean aliasing ........................................................................................ 123 Further information about how Java-based configuration works internally ........ 123 4.13. Registering a LoadTimeWeaver .................................................................... 124 4.14. Additional Capabilities of the ApplicationContext .......................................... 125 Internationalization using MessageSource ...................................................... 125 Standard and Custom Events ......................................................................... 128 Convenient access to low-level resources ....................................................... 131 Convenient ApplicationContext instantiation for web applications ................... 132 Deploying a Spring ApplicationContext as a J2EE RAR file ............................ 133 4.15. The BeanFactory .......................................................................................... 133 BeanFactory or ApplicationContext? ............................................................. 134 Spring Framework 3.1 Reference Documentation v Glue code and the evil singleton .................................................................... 135 5. Resources ................................................................................................................. 137 5.1. Introduction ................................................................................................... 137 5.2. The Resource interface ................................................................................... 137 5.3. Built-in Resource implementations .................................................................. 138 UrlResource ................................................................................................. 138 ClassPathResource ....................................................................................... 139 FileSystemResource ..................................................................................... 139 ServletContextResource ................................................................................ 139 InputStreamResource .................................................................................... 139 ByteArrayResource ...................................................................................... 140 5.4. The ResourceLoader ....................................................................................... 140 5.5. The ResourceLoaderAware interface ............................................................... 141 5.6. Resources as dependencies ............................................................................. 142 5.7. Application contexts and Resource paths ......................................................... 142 Constructing application contexts .................................................................. 142 Constructing ClassPathXmlApplicationContext instances - shortcuts ....... 143 Wildcards in application context constructor resource paths ............................ 144 Ant-style Patterns ................................................................................. 144 The classpath*: prefix ........................................................................... 145 Other notes relating to wildcards ............................................................ 145 FileSystemResource caveats .......................................................................... 146 6. Validation, Data Binding, and Type Conversion .......................................................... 148 6.1. Introduction ................................................................................................... 148 6.2. Validation using Spring's Validator interface .................................................... 148 6.3. Resolving codes to error messages .................................................................. 150 6.4. Bean manipulation and the BeanWrapper ........................................................ 150 Setting and getting basic and nested properties ............................................... 151 Built-in PropertyEditor implementations ........................................................ 152 Registering additional custom PropertyEditors ....................................... 155 6.5. Spring 3 Type Conversion .............................................................................. 158 Converter SPI ............................................................................................... 158 ConverterFactory .......................................................................................... 159 GenericConverter ......................................................................................... 160 ConditionalGenericConverter ................................................................ 160 ConversionService API ................................................................................. 161 Configuring a ConversionService .................................................................. 161 Using a ConversionService programatically ................................................... 162 6.6. Spring 3 Field Formatting ............................................................................... 162 Formatter SPI ............................................................................................... 163 Annotation-driven Formatting ....................................................................... 164 Format Annotation API ......................................................................... 165 FormatterRegistry SPI .................................................................................. 166 FormatterRegistrar SPI ................................................................................. 166 Configuring Formatting in Spring MVC ......................................................... 167 Spring Framework 3.1 Reference Documentation vi 6.7. Spring 3 Validation ........................................................................................ 168 Overview of the JSR-303 Bean Validation API ............................................... 168 Configuring a Bean Validation Implementation .............................................. 169 Injecting a Validator ............................................................................. 169 Configuring Custom Constraints ............................................................ 170 Additional Configuration Options .......................................................... 170 Configuring a DataBinder ............................................................................. 170 Spring MVC 3 Validation ............................................................................. 171 Triggering @Controller Input Validation ............................................... 171 Configuring a Validator for use by Spring MVC ..................................... 171 ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 输入关键字,在本站1000多万海量源码库中尽情搜索: