Your SlideShare is downloading. ×
0
SPRING 1. overview
SPRING 1. overview
SPRING 1. overview
SPRING 1. overview
SPRING 1. overview
SPRING 1. overview
SPRING 1. overview
SPRING 1. overview
SPRING 1. overview
SPRING 1. overview
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 1. overview

393

Published on

Refers: …

Refers:
Manning Spring in Action 3rd Edition.

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
393
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
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. <ul>Spring </ul><ul>Francesco Ierna </ul>
  2. <ul>Spring Overview </ul><ul><ul><li>Container is at the core of the Spring Framework. Spring’s container uses dependency injection (DI) to manage the components that make up an application. This includes creating associations between collaborating components. As such, these objects are cleaner and easier to understand, support reuse, and are easy to unit test. </li></ul></ul><ul><ul><li>There’s no single Spring container : </li></ul></ul><ul><ul><ul><li>Bean factories (defined by the org.springframework.beans.factory.BeanFactory interface) are the simplest of containers, providing basic support for DI
  3. Application contexts (defined by the org.springframework.context.ApplicationContext interface) build on the notion of a bean factory by providing application framework services, such as the ability to resolve textual messages from a properties file and the ability to publish application events to interested event listeners. </li><ul><li>ClassPathXmlApplicationContext —Loads a context definition from an XML file located in the classpath, treating context definition files as classpath resources.
  4. FileSystemXmlApplicationContext —Loads a context definition from an XML file in the file system
  5. XmlWebApplicationContext — from an XML file con-tained within a web application. </li></ul><li>FileSystemXmlApplicationContext(1) vs ClassPathXmlApplicationContext(2) </li><ul><li>(1) will look for foo.xml in a specific location within the file system, whereas (2) will look for foo.xml anywhere in the classpath (including JAR files). </li></ul></ul></ul></ul>
  6. <ul>Code Application Context </ul>Loading an application context from the file system or from the classpath is similar to how you load beans into a bean factory. <ul><li>For example, here’s how you’d load a File - SystemXmlApplicationContext: </li></ul>ApplicationContext context = new FileSystemXmlApplicationContext(&quot;c:/foo.xml&quot;); <ul><li>Similarly, you can load an application context from within the application’s classpath using ClassPathXmlApplicationContext :
  7. ApplicationContext context = new ClassPathXmlApplicationContext(&quot;foo.xml&quot;); </li></ul>
  8. <ul>Spring Framework Modules </ul>
  9. <ul>Spring Modules Overview </ul><ul><li>Spring Framework is a container that manages how the beans in a Spring-enabled application are created, configured, and managed. Within this module you’ll find the bean factory, which is the portion of Spring that provides DI
  10. AOP Modules  : Provides rich support for aspect-oriented programming in its AOP module
  11. DATA ACCESS AND INTEGRATION : data access objects (DAO) module abstracts away the boilerplate code so that you can keep your database code clean and simple, and prevents problems that result from a failure to close database ressources </li><ul><li>Spring’s ORM support builds on the DAO sup-port , providing a convenient way to build DAOs for several ORM solutions
  12. Java Message Service (JMS) for asynchronous integration with other applications through messaging </li></ul><li>TESTING  : pring provides a module ded-icated to testing Spring applications </li></ul>
  13. <ul>DI </ul><ul><li>DEF  : With DI, on the other hand, objects are given their dependencies at creation time by some third party that coordinates each object in the system. Objects aren’t expected to create or obtain their dependencies—dependencies are injected into the objects that need them
  14. Advantages  : </li></ul><ul><ul><li>tightly coupled
  15. Class doesn’t create his own quest
  16. the dependency can be swapped out with a different implementation without the depending object knowing the difference
  17. Code is easy to read. </li></ul></ul>
  18. <ul>Code with DI </ul>
  19. <ul>How DI works? </ul><ul><li>The Spring application context is fully responsible for the creation of and wiring of the objects that make up the application. </li></ul><ul><ul><li>loads the Spring context from one or more XML files located in the application’s classpath as ClassPathXmlApplicationContext -> Note that this class knows nothing about which type of Quest our hero has </li></ul></ul>
  20. <ul>Bean Life with Spring </ul>
  21. <ul>AOP Overview </ul><ul><li>AOP : makes it possible to modularize these services and then apply them declaratively to the components that they should affect. This results in components that are more cohesive and that focus on their own specific concerns, completely ignorant of any sys-tem services that may be involved. In short, aspects ensure that POJOs remain plain. </li></ul>

×