The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring...
-
Upload
godwin-arnold -
Category
Documents
-
view
239 -
download
0
Transcript of The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring...
![Page 1: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/1.jpg)
The Spring Framework
A quick overview
![Page 2: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/2.jpg)
The Spring Framework
1. Spring principles: IoC
2. Spring principles: AOP
3. A handful of services
4. A MVC framework
5. Conclusion
![Page 3: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/3.jpg)
1. Spring principles: IoC
Inversion of Control: an object interacts with its environment
Objects are « plugged » one in another
The environment is set up by the container instead of the object itself
![Page 4: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/4.jpg)
1. Spring principles: IoC
Without IoC:
With IoC
![Page 5: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/5.jpg)
1. Spring principles: IoC
Useful for separating dao and business layer Useful for separating controllers and
business layer
The code is more extensible, easier to read, and modules/layers can easily be replaced
![Page 6: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/6.jpg)
2. Spring principles: AOP
Separates the core business code from the aspects we wrap around it: security, transaction management, …
Through AOP, we add transversal functionalities to objects (ie not directly related to the code it contains)
![Page 7: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/7.jpg)
2. Spring principles: AOP
Without AOP
With AOP
![Page 8: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/8.jpg)
2. Spring principles: AOP
Useful for automatic handling of transaction with Hibernate
Useful for Acegi (automatic credentials checking before executing some methods)
Code smaller, easier to read (not polluted by transversal aspects not directly relevant)
![Page 9: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/9.jpg)
3. A handful of services
![Page 10: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/10.jpg)
3. A handful of services
DAO support: Spring offers templates classes to deal with a Hibernate/JDBC/… connection
Exception translator: all the proprietary Hibernate/JDBC/… exceptions are catched by Spring, and rethrown as Runtime non-specific consistent exceptions
Hence the DAO code is not dependant on the underlying datasource!
![Page 11: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/11.jpg)
3. A handful of services
Many ORM tools are supported: Hibernate, JDO, Apache OJB, iBATIS
Templates using IoC to reduce the amount of code in the DAO objects
![Page 12: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/12.jpg)
3. A handful of services
Support of RMI Very easy to expose and connect to
webservices
Support of JMS JMS templates, JMSException translation
![Page 13: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/13.jpg)
3. A handful of services
![Page 14: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/14.jpg)
3. A handful of services
A mail abstraction layer– Templates
Jobs scheduling (Quartz, Timer)
– Cron– Business layer unaware
![Page 15: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/15.jpg)
4. A full MVC Framework
Clear separation of roles: controller, validator, form object, Dispatch servlet, View resolver, …
Extensible and adaptable Several views of a result (pdf, excel, html, …)
Can be wired (possible to use transparently the IoC pattern)
![Page 16: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/16.jpg)
4. A full MVC Framework
Can be used with other frameworks: JSF, Struts, Tapestry, Webwork
Completely transparent: no need to change anything in what is done by these other frameworks
![Page 17: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/17.jpg)
4. A full MVC Framework
![Page 18: The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.](https://reader035.fdocuments.in/reader035/viewer/2022081513/56649dba5503460f94aab4b2/html5/thumbnails/18.jpg)
5. Conclusion
Learning curve
XML configuration & annotations Tiny Open-source and free Active development Linked with several important Java projects
(Hibernate, Acegi, …)