Spring 3.1 Features Worth Knowing About(Available For Download Today)Rossen Stoyanchev, Software Engineer                 ...
Agenda Environment Java Configuration DSL Cache Abstraction                           CONFIDENTIAL   2
Moving an Application Across Environments       TRANSFER SERVICE                     DEV         ACCOUNT DAO              ...
Environment-Specific Properties In XML                                                Property Source:                    ...
Environment-Specific Properties In Java                             Property Source:                             Java syst...
Spring EL Expressions in Spring 3.0 Easier to see where properties originate from                                CONFIDEN...
What About “Structural” Differences ?                CONFIDENTIAL            7
Environment-Specific Configuration in XML  prod/database-context.xml                                         dev/database-...
Environment-Specific Configuration in Java                                      Accommodate                               ...
Spring 3.1 “Environment” Abstraction A concrete representation with two key aspects • Property Sources • Bean Profiles  P...
Managing Property Sources In standalone code In a Web application • Implement ApplicationContextInitializer • Register v...
Accessing Environment Properties In standalone code Via @Autowired or EnvironmentAware interface In configuration (via ...
Beans Profiles With XML Assign all beans to profile                            Multiple profiles can be listed Assign en...
Bean Profiles In Java                        CONFIDENTIAL   14
Bean Profile Activation In code In Web applications                          CONFIDENTIAL   15
Agenda Environment Java Configuration DSL Cache Abstraction                           CONFIDENTIAL   16
Custom XML Namespaces Custom XML namespaces have become very popular • In Spring and in other frameworks Succinct and hi...
Feature Specifications Java configuration equivalent to an XML namespace Declared in @FeatureConfiguration classes      ...
FeatureSpecifications Are Designed For Ease of Use                       CONFIDENTIAL                  19
Agenda Environment Java Configuration DSL Cache Abstraction                           CONFIDENTIAL   20
Spring 3.1 Cache Abstraction CacheManager and Cache abstractions • org.springframework.cache Backend adapters for EhCach...
Annotation-Based Caching                    Cache name                                  Custom key                        ...
Spring 3.1 M1 Blog Series:----------------------------------http://blog.springsource.com/2008/03/26/spring-java-configurat...
Thank You   CONFIDENTIAL   24
Upcoming SlideShare
Loading in …5
×

Spring 3.1 Features Worth Knowing About

4,098 views

Published on

Published in: Technology
1 Comment
5 Likes
Statistics
Notes
No Downloads
Views
Total views
4,098
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
138
Comments
1
Likes
5
Embeds 0
No embeds

No notes for slide

Spring 3.1 Features Worth Knowing About

  1. 1. Spring 3.1 Features Worth Knowing About(Available For Download Today)Rossen Stoyanchev, Software Engineer CONFIDENTIAL © 2010 SpringSource, A division of VMware. All rights reserved
  2. 2. Agenda Environment Java Configuration DSL Cache Abstraction CONFIDENTIAL 2
  3. 3. Moving an Application Across Environments TRANSFER SERVICE DEV ACCOUNT DAO QA DATA SOURCE PROD CONFIDENTIAL 3
  4. 4. Environment-Specific Properties In XML Property Source: dev/database.properties Property Source: Java system property dev/database.properties qa/database.properties java -DENV=prod ... prod/database.properties CONFIDENTIAL 4
  5. 5. Environment-Specific Properties In Java Property Source: Java system property? CONFIDENTIAL 5
  6. 6. Spring EL Expressions in Spring 3.0 Easier to see where properties originate from CONFIDENTIAL 6
  7. 7. What About “Structural” Differences ? CONFIDENTIAL 7
  8. 8. Environment-Specific Configuration in XML prod/database-context.xml dev/database-context.xml Choose from multiple app-context.xml files to accommodate differences CONFIDENTIAL 8
  9. 9. Environment-Specific Configuration in Java Accommodate differences in code CONFIDENTIAL 9
  10. 10. Spring 3.1 “Environment” Abstraction A concrete representation with two key aspects • Property Sources • Bean Profiles Property Source: Bean Profile: A variety of sources: property A logical group of bean files, system properties, definitions. Registered only if servlet context, JNDI, etc. the profile is active. CONFIDENTIAL 10
  11. 11. Managing Property Sources In standalone code In a Web application • Implement ApplicationContextInitializer • Register via contextInitializerClasses context parameter in web.xml Default property sources • JVM properties • System envrionment variables CONFIDENTIAL 11
  12. 12. Accessing Environment Properties In standalone code Via @Autowired or EnvironmentAware interface In configuration (via placeholders) <context:property-placeholder/> also now falls back on Environment property sources CONFIDENTIAL 12
  13. 13. Beans Profiles With XML Assign all beans to profile Multiple profiles can be listed Assign enclosed beans to a profile CONFIDENTIAL 13
  14. 14. Bean Profiles In Java CONFIDENTIAL 14
  15. 15. Bean Profile Activation In code In Web applications CONFIDENTIAL 15
  16. 16. Agenda Environment Java Configuration DSL Cache Abstraction CONFIDENTIAL 16
  17. 17. Custom XML Namespaces Custom XML namespaces have become very popular • In Spring and in other frameworks Succinct and highly expressive Each namespace element can result in the registration of any number of bean definitions Question: How do get the same benefits in Java configuration? CONFIDENTIAL 17
  18. 18. Feature Specifications Java configuration equivalent to an XML namespace Declared in @FeatureConfiguration classes Beans declared elsewhere can be autowired in. Results in same bean declarations as <tx:annotation-driven /> CONFIDENTIAL 18
  19. 19. FeatureSpecifications Are Designed For Ease of Use CONFIDENTIAL 19
  20. 20. Agenda Environment Java Configuration DSL Cache Abstraction CONFIDENTIAL 20
  21. 21. Spring 3.1 Cache Abstraction CacheManager and Cache abstractions • org.springframework.cache Backend adapters for EhCache, GemFire, Coherence, etc. Cache namespace • <cache:annotation-driven /> CacheManager SPI • EhCacheManager • GemFireCacheManager CONFIDENTIAL 21
  22. 22. Annotation-Based Caching Cache name Custom key Cache condition CONFIDENTIAL 22
  23. 23. Spring 3.1 M1 Blog Series:----------------------------------http://blog.springsource.com/2008/03/26/spring-java-configuration-whats-new-in-m3/https://github.com/cbeams/spring-3.1-profiles-xmlhttps://github.com/cbeams/spring-3.1-profiles-javahttps://github.com/cbeams/spring-3.1-featurespechttps://github.com/rstoyanchev/spring-3.1-mvc-java-configReview updated Spring Reference DocumentationProvide feedback via JIRA and Forums CONFIDENTIAL 23
  24. 24. Thank You CONFIDENTIAL 24

×