Your SlideShare is downloading. ×
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Spring Framework Introduction
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Spring Framework Introduction

942

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
942
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
32
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Spring Framework IntroductionAlex Su2010/06/14 Copyright 2010 TCloud Computing Inc.
  • 2. Agenda•Concept – IOC(Inverse of Control and Dependency Injection) – AOP(Aspect-Oriented Programming)•Core Technologies – Architecture – Xml v.s. Annotation – SpEL – Testing•Integration – CXF(web services and restful services) Trend Micro Confidential
  • 3. IOC•IOC Type •Type 1 : interface injection •Type 2 : setter injection •Type 3 : constructor injection Trend Micro Confidential
  • 4. AOPTrend Micro Confidential
  • 5. AOPTrend Micro Confidential
  • 6. AOP• Aspect• Advice• Interceptor• Introduction• Joinpoint• Pointcut• Target• Proxy• Weave Trend Micro Confidential
  • 7. AOPTrend Micro Confidential
  • 8. AOP@Aspectclass BeforeExample { @Before("execution(* com.xyz.myapp.dao.*.*(..))") public void doAccessCheck() { // ... }}@Aspectclass AfterReturningExample {@AfterReturning("com.xyz.myapp.SystemArchitecture.dataAccessOperation()") public void doAccessCheck() { // ... }} Trend Micro Confidential
  • 9. AOP@Aspectclass AroundExample {@Around("com.xyz.myapp.SystemArchitecture.businessService()") public Object doBasicProfiling(ProceedingJoinPoint pjp)throws Throwable { // start stopwatch Object retVal = pjp.proceed(); // stop stopwatch return retVal; }} Trend Micro Confidential
  • 10. Pointcut designator• execution(modifiers-pattern? ret-type-pattern declaring-type-pattern? name- pattern(param-pattern) throws-pattern?)• execution(public * *(..))• execution(* com.xyz.service.AccountService.*(..))• within(com.xyz.service.*)• within(com.xyz.service..*)• this(com.xyz.service.AccountService)• target(com.xyz.service.AccountService) Trend Micro Confidential
  • 11. Architecture Trend Micro Confidential
  • 12. Architecture Trend Micro Confidential
  • 13. Architecture• Bean Scope • Singleton • Prototype • Request • Session • Custom Trend Micro Confidential
  • 14. Architecture Trend Micro Confidential
  • 15. Architecture Trend Micro Confidential
  • 16. Xml v.s. Annotationpublic class SimpleMovieLister { private MovieFinder movieFinder; public void find() { movieFinder.find(); } public void setMovieFinder(MovieFinder movieFinder) { this.movieFinder = movieFinder; }} Trend Micro Confidential
  • 17. Xml v.s. Annotation<bean id="movieFinder" class="com.sample.MovieFinder"/><bean id="simpleMovieLister” class="com.sample.SimpleMovieLister"> <property name="movieFinder"> <ref local="movieFinder"/> </property></bean> Trend Micro Confidential
  • 18. Xml v.s. Annotation@Servicepublic class SimpleMovieLister { @Resource private MovieFinder movieFinder; public void find() { movieFinder.find(); }} Trend Micro Confidential
  • 19. Xml v.s. Annotation• stereotype annotations • @Component • @Service • @Controller • @Repository Controller Service Repository Trend Micro Confidential
  • 20. SpEL• Literal expressions• Properties, Arrays, Lists, Maps, Indexers• Methods• Operators• Assignment• Types• Constructors• Variables• User defined functions• Ternary Operator• Elvis Operator• Safe Navigation operator• Collection Selection• Collection Projection• Expression templating Trend Micro Confidential
  • 21. Testing@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations = { "classpath:appContext_core.xml", "classpath:appContext_index.xml”})public abstract class AbstractTestCase {} Trend Micro Confidential
  • 22. Testing• Spring-specific annotations – @TransactionConfiguration – @BeforeTransaction – @AfterTransaction – @IfProfileValue – @ExpectedException – @Timed – @Repeat Trend Micro Confidential
  • 23. CXF• JAX-WS Support – SOAP 1.1, 1.2• RESTful services – JSON & XML support• WS-* Support – WS-Addressing, WS-Policy, WS-ReliableMessaging and WS-Security• Spring Integration• Bus – Fast Infoset Trend Micro Confidential
  • 24. CXF• RESTful services – JAX-RS – JAX-WS Provider and Dispatch – HTTP Binding(deprecated) Trend Micro Confidential
  • 25. CXF• Parameters – @PathParam – @QueryParam – @HttpHeader – @MatrixParam – @FormParam – @CookieParam – PathSegment Trend Micro Confidential
  • 26. Reference• http://caterpillar.onlyfun.net/Gossip/• http://www.springsource.org/• http://cxf.apache.org/ Trend Micro Confidential
  • 27. THANK YOU! Trend Micro Confidential

×