+ All Categories
Home > Technology > Introduction to Spring Framework

Introduction to Spring Framework

Date post: 10-May-2015
Category:
Upload: andy-chan
View: 4,830 times
Download: 1 times
Share this document with a friend
Description:
Presentation of CityGrid internal developer training.
Popular Tags:
60
Developer Training Introduction to Spring Framework What’s New in 3.0 & 3.1?
Transcript
Page 1: Introduction to Spring Framework

Developer Training

Introduction to Spring FrameworkWhat’s New in 3.0 & 3.1?

Page 2: Introduction to Spring Framework

Who am I?

• Andy Chan• Software Architect• Co-Author of Apress Pro Spring Integration• ISBN: 978-1-4302-3345-9• Twitter: iceycake• Skype: achan1218

Page 3: Introduction to Spring Framework

• Pro Spring 3• Clarence Ho, Rob Harrop• Published April 18, 2012• ISBN: 978-1-4302-4107-2• Spring 3.0 & 3.1

Page 4: Introduction to Spring Framework

What is Spring?

“Most Popular Application Development Framework for Enterprise Java.”

http://www.springsource.org

Page 5: Introduction to Spring Framework

History

Page 6: Introduction to Spring Framework

Spring Overview

• Spring Framework• Spring Batch• Spring Integration• Spring Security• Spring Web Service• Spring Data• Spring Hadoop

• Spring Mobile• Spring Social• Spring Web Flow• Spring BlazeDS• Spring Roo• Spring .NET• Spring Python• …

Page 7: Introduction to Spring Framework

Spring Overview

• Spring Framework• Spring Batch• Spring Integration• Spring Security• Spring Web Service• Spring Data• Spring Hadoop

• Spring Mobile• Spring Social• Spring Web Flow• Spring BlazeDS• Spring Roo• Spring .NET• Spring Python• …

Page 8: Introduction to Spring Framework

Spring Overview

• Spring Framework• Spring Batch• Spring Integration• Spring Security• Spring Web Service• Spring Data• Spring Hadoop

• Spring Mobile• Spring Social• Spring Web Flow• Spring BlazeDS• Spring Roo• Spring .NET• Spring Python• …

Page 9: Introduction to Spring Framework

Spring FrameworkOverview

Page 10: Introduction to Spring Framework

Spring FrameworkOverview

• Foundation of Spring Extentions• Inversion of Control (IoC) and Containers• Spring Profile• Abstractions for JDBC, JPA, JTA, JMS, WS• MVC Framework

Page 11: Introduction to Spring Framework

Inversion of Control (IoC)

Page 12: Introduction to Spring Framework

Inversion of Control (IoC)

• Java EE: EJB and EJB Container• Spring: POJO and POJO Container• Spring vs Java EE => Lightweight• Object Creation• Object Lookup• Object Life Cycle Management

Page 13: Introduction to Spring Framework

Inversion of Control (IoC)

Page 14: Introduction to Spring Framework

Inversion of Control (IoC)

Page 15: Introduction to Spring Framework

Inversion of Control (IoC)

Page 16: Introduction to Spring Framework

Inversion of Control (IoC)

Page 17: Introduction to Spring Framework

Inversion of Control (IoC)

Page 18: Introduction to Spring Framework

Spring IoC Container

Page 19: Introduction to Spring Framework

Maven & Spring 2.5

Page 20: Introduction to Spring Framework

Maven & Spring 2.5

Page 21: Introduction to Spring Framework

Maven & Spring 3.0/3.1

Page 22: Introduction to Spring Framework

Maven & Spring 3.0/3.1

Page 23: Introduction to Spring Framework

Spring IoC Container

Page 24: Introduction to Spring Framework

Spring IoC Container

Page 25: Introduction to Spring Framework

Bean Scopes

Page 26: Introduction to Spring Framework

Spring IoC Container

Page 27: Introduction to Spring Framework

Spring IoC Container

Page 28: Introduction to Spring Framework

Auto Wiring

Page 29: Introduction to Spring Framework

Auto Wiring (Cont’d)

Page 30: Introduction to Spring Framework

Auto Discovery

Page 31: Introduction to Spring Framework

Auto Discovery (Cont’d)

Page 32: Introduction to Spring Framework

Auto Discovery (Cont’d)

Page 33: Introduction to Spring Framework

Constructor

Page 34: Introduction to Spring Framework

Constructor (Cont’d)

Page 35: Introduction to Spring Framework

XML Based Configuration

• “XML Programming”• No Unit Testing• Error Message is not Helpful• Difficult to Catch Typo• Difficult to Troubleshoot

Page 36: Introduction to Spring Framework

JavaConfig

• Spring 3.0+• Answer to Google’s Guice• Annotation/Java Based DI• Same Level of Isolation as XML Configuration • Work with XML Configuration• Constructor is Useful again – Immutable• Unit Testing?

Page 37: Introduction to Spring Framework

JavaConfig (Cont’d)

Page 38: Introduction to Spring Framework

JavaConfig (Cont’d)

Page 39: Introduction to Spring Framework

JavaConfig (Cont’d)

Page 40: Introduction to Spring Framework

Property Management

Page 41: Introduction to Spring Framework

Maven Profile

Page 42: Introduction to Spring Framework

Maven Profile (Cont’d)

Page 43: Introduction to Spring Framework

Maven Profile (Cont’d)

• Package Time Substitute• Security Concern– Exposing Username/Password

• Rebuild if Configuration Changes

Page 44: Introduction to Spring Framework

Spring & Properties

Page 45: Introduction to Spring Framework

Spring & Properties (Cont’d)

Page 46: Introduction to Spring Framework

Spring & Properties (Cont’d)

• Managed Properties File Safely• No Rebuild if Configurations Need Change• Can Use JavaConfig & Auto Wiring

Page 47: Introduction to Spring Framework

Spring Profile

Page 48: Introduction to Spring Framework

Spring Profile (Cont’d)

Page 49: Introduction to Spring Framework

Spring Profile (Cont’d)

Page 50: Introduction to Spring Framework

Spring Profile (Cont’d)

Page 51: Introduction to Spring Framework

Spring Profile (Cont’d)

• Different implementations based on Profile• Use Cases– Integration Testing vs Production Deployment– Embedding RDBMS vs Oracle– Embedding ActiveMQ vs Standalone ActiveMQ

Page 52: Introduction to Spring Framework

Spring Framework

Page 53: Introduction to Spring Framework

Data Access

• Transaction Management• JDBC & DAO– DataSource– JDBCTemplate

• ORM Support– Hibernate– Spring Data (JPA)

Page 54: Introduction to Spring Framework

Integration Framework

• Web Services– RestTemplate– WebServiceTemplate

• Message Queue– JmsTemplate– AmqpTemplate (Requires Amqp Extension)

• JMX

Page 55: Introduction to Spring Framework

Task Management & Scheduling

• Task Management– Task Executors• ConcurrentTaskExecutor• ThreadPoolTaskExecutor• TimerTaskExecutor

• Scheduling– Quartz Based– Spring 3.0+• @Scheduled, @Async

Page 56: Introduction to Spring Framework

Dynamic Language Support

• Not Java 6 Scripting Engine (javascript)• JRuby• Groovy• BeanShell• Spring Hadoop (Extension)– PIG– HIVE

Page 57: Introduction to Spring Framework

Cache Abstraction

• Spring 3.1+• @Cacheable(“cacheName”)• @Cacheable({“cache1”, “cache2”})• @Cacheable(value=“cache1”, key=“#id”)• Spring Expression Language (SpEL)• Cache Storage– ConcurrentMap– Ehcache

Page 58: Introduction to Spring Framework

Example Codes

• https://github.com/iceycake/intro-spring

Page 59: Introduction to Spring Framework

References

• http://www.springsource.org/spring-framework

Page 60: Introduction to Spring Framework

Questions


Recommended