Spring framework

download Spring framework

If you can't read please download the document

Transcript of Spring framework

  • 1. Spring Framework Sean Melody November 2, 2011

2. Introduction Spring training? 3. What is the Spring Framework?

  • Originally created by Rod Johnson as an alternative to J2EE / EJB

4. Interface21 / Springsource now owned by VMWare 5. Apache 2.0 Licensed 6. Rich ecosystem of tools, frameworks and patterns 7. Widely adopted in Java community 8. Strong forum and large knowledge base on Stackoverflow.com 9. Life before Spring 10. The Spring Ecosystem

  • Spring core

11. Security 12. Web / MVC 13. Aspect Oriented Programming (AOP) 14. Transaction Management 15. Springsource Tool Suite 16. Spring social

  • Remoting

17. Testing 18. Integration (EIP) 19. Batch processing 20. Messaging 21. Spring Roo 22. tcServer 23. Core Principles

  • Inversion of Control
  • Dependency Injection

Standards compliance a secondary goal 24. Test first 25. Avoid coupling to Spring framework 26. Cross cutting concerns through simplified AOP 27. Convention over Configuration 28. Examples We're using Spring in SLI every day!Here's how: API Security, IoC container, Test Ingestion IoC container, Test DAL Spring Data, IoC Container, Test Databrowser Spring MVC, IoC, Test 29. Inversion of Control (IoC)

  • Component scanning
    • Bean stereotypes
  • 30. Auto-wiring

ApplicationContextAware 31. @PostConstruct

  • Java: @Service public class SchoolRepositoryService implements SchoolService { @Autowired SchoolRepository schoolRepository;
  • XML:

32. 33. Spring Data

  • Repository pattern in the DAL abstracts implementation of OR/M from service and ingestion layers

34. Allows for swap-out of persistence technology if needed 35. Eliminates boilerplate code that exists in many JPA / Hibernate projects by proxying DAOs.

  • db.xml:

36. Security

  • API module has in-memory authentication example in securityContext.xml

37. Leverages the security namespace 38. More usage of Spring Security's permission evaluation coming in Sprint 3 39. Spring FAQ

  • Q: Can Spring help me decouple infrastructure concerns from my business logic?
  • A: Yes, that's the core use case around using the IoC container

Q: Can Spring help me eliminate repetitive code?

  • A: Runtime proxying, dependency injection, and AOP are solutions

Q: Can Spring help me isolate layers during unit test time?

  • A: Yes, use different application contexts that mock out external dependencies

Q: Can Spring help me with my Christmas shopping or cooking my potluck dish?

  • A: No, sorry.

40. References

  • http://www.martinfowler.com/articles/injection.html

41. http://www.springsource.org/