Spring core v3.x Prepared by: Nhan Le. History v3.0 Spring Expression Language Java based bean metadata v3.1 Cache Abstraction Bean Definition Profile.

Slides:



Advertisements
Similar presentations
Copyright © 2005 Finetix LLC All Rights Reserved 0 Spring Framework Developer Session Chris Donnan & Solomon Duskis The Peer Frameworks Series -.Net and.
Advertisements

Welcome to CODE SPREAD Simple Concepts of Coding | Programming.
Spring Transaction & Spring AOP
AspectWerkz 2 - and the road to AspectJ 5 Jonas Bonér Senior Software Engineer BEA Systems.
Introduction to Spring Continued Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack.
Spring, Hibernate and Web Services 13 th September 2014.
Introduction to Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
Enterprise Application Development Sadegh Aliakbary An Introduction to Spring Framework www. JavaCup.ir.
Spring.Net Steinar Dragsnes steinar.dragsnes at viz.no.
1 November 21st 2009 Shaun Abram An Introduction to Spring.
The Spring Framework: A brief introduction to Inversion of Control James Brundege
Introduction to Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
Dependency Injection and Model-View-Controller. Overview Inversion of Control Model-View-Controller.
Spring Framework. Spring Overview Spring is an open source layered Java/J2EE application framework Created by Rod Johnson Based on book “Expert one-on-one.
Spring Overview, Application demo -Midhila Paineni 09/23/2011 Spring Overview, Application demo9/8/20151.
Introduction to the Spring Framework Rajesh. Spring Mission Statement J2EE should be easier to use OO design is more important than any implementation.
Presented by Robert Zaremba.  Remote messages must be sent to a message queue so that components are decoupled  Both sides of a communication must be.
Parsley Introduction Kui Huang Oct. 13, Topics Background Dependency Injection Object Lifecycle Message Bus Sample FW Extensions.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Understanding the Bean Lifecycle An.
DI, AOP, Strategies- Patterns around Spring DI, AOP, Strategies Patterns around Spring.
PicoContainer Presented by: Jim O’Hara Ed Kausmeyer Jingming Zhang.
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
Anti Orgla, Nortal AS Spring Framework
DEPENDENCY INJECTION & INVERSION OF CONTROL. WHAT’S GOING TO BE COVERED Quick intro to C# for Java developers Dependency Injection Inversion of Control.
Spring Framework. Spring Overview Spring is an open source layered Java/J2EE application framework Created by Rod Johnson Based on book “Expert one-on-one.
Introduction to Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
APCS Java AB 2004 Review of CS1 and CS2 Review for AP test #1 Sources: 2003 Workshop notes from Chris Nevison (Colgate University) AP Study Guide to go.
Spring Training 17/09/ Dependency Injection.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Introduction to Spring Framework,
A Distributed Aspect-Oriented System for J2EE Applications Muga Nishizawa and Shigeru Chiba (Tokyo Institute of Technology, Japan) Background - As benefits.
Spring 101 Struts University Series. About Ted Husted Lead author, Struts in Action Co-Author, JUnit in Action Member, Apache Software Foundation Member,
A Presentation By V AIBHAV S AHARAN Web-enHanced Information Management COMS E6125.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Spring Remoting Simplifying.
© Keren Kalif Advanced Java Topics Written by Keren Kalif, Edited by Liron Blecher.
Refactoring & Testability. Testing in OOP programming No life in flexible methodologies and for refactoring- infected developers without SOME kind of.
Introducing Allors Applications, Tools & Platform.
Inter-Type Declarations in AspectJ Awais Rashid Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
AspectJ – AOP for Java Tom Janofsky. Instructor at Penn State Abington Consultant with Chariot Solutions JUG Member.
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
Java EE - Dependency Injection -
1 Spring Framework April, 2012 Lam Ho Lam To. © 2010 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2 1.Spring Overview 2.Framework.
SCA and Java n SCA provides support for multiple Java-based component implementation types l Java POJOs (implementation.java) l Spring Beans (implementation.spring)
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring AOP – Part 2 Advanced Aspect-Oriented.
Kansas City Java User’s Group Jason W. Bedell July 12, 2006
问题 Code scattering Blocks of duplicated code Blocks of complementary code, and different modules implementing complementary parts of the concern Code.
Comparison of Different AOP Approaches Presented by: Xiaojing Wang.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
2006/2007 Licence Apache 2.0 Castle.Igloo. Castle Igloo Basics Pre-require Concept Scopes PageFlow Configuration Controller View Exemple Castle.Igloo.
Singleton Academy, Pune. Course syllabus Singleton Academy Pune – Course Syllabus1.
L’origine dei mali: le dipendenze tra componenti Stefano Leli 14° Workshop DotNetMarche Venerdì 16 aprile
Introduction to Inversion Of Control (IOC). IOC Definition (based on Wikipedia)  Consider the way in which an object obtains references to its dependencies.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Introduction to Spring Framework.
Leveraging ColdSpring to build a robust Flex applications Chris Scott, Cynergy Systems.
CS520 Web Programming Spring – Inversion of Control Chengyu Sun California State University, Los Angeles.
J2EE Lecture 6: Spring – IoC and Dependency Injection
CS520 Web Programming Spring – Inversion of Control
Chengyu Sun California State University, Los Angeles
Inversion of Control and ColdFusion: Using ColdSpring
By Ru Shen Department of Computer Science UAlbany, 2008
Chengyu Sun California State University, Los Angeles
AOP in .NET Business Rules + Plumbing = Enterprise Software
Introduction to Spring Framework and Dependency Injection
JAsCo an Aspect-Oriented approach tailored for
Tuesday Brown Bag Inversion of Control with Howard Abrams
CS520 Web Programming Spring – Aspect Oriented Programming
Leveraging ColdSpring To Make Better Applications
Designing For Testability
Aspect Oriented Programming
Presentation transcript:

Spring core v3.x Prepared by: Nhan Le

History v3.0 Spring Expression Language Java based bean metadata v3.1 Cache Abstraction Bean Definition Profile Environment abstraction Test Context v3.2 Meta-annotations Global date & time format

Agenda IoC vs DI IOC Container Validation, Data Binding & Type conversion Spring Expression Language Testing Spring AOP Cache Abstraction

Inversion of control is a design principle that it decouples objects from specific lookup mechanisms and implementations of the objects it depends on Dependency injection is a form of IoC, where removes hard-coded dependencies and make it possible to change them at Compile time or Run Time IoC vs DI

Reduce coupling Both constructor and setter dependency injection reduce coupling. Improves testability Replace actual object with mock object which improves testability by writing simple JUnit tests which uses mock object. Flexibility As side benefit of loose coupling, because of DI you can replace non effective implementation with better one later Advantages of IoC

Dependencies Dependency Injection –Constructor based –Setter based –Interface Injection Dependency resolution process Circular dependencies

Dependencies type matching argument index argument name

IOC Container The interface org.springframework.context.ApplicationContext represents the Spring IOC container and is responsible for instantiating, configuring, and assembling the beans by reading configuration metadata Configuration Metadata - XML based - Annotation based - Java based

IOC – Bean Lifecycle

IOC – Bean Naming beans –Id, name and alias Instantiating beans –Constructor –Static factory –Method factory Inner beans –Inject able? –Scope?

Instantiating Beans Constructor Static Factory method Instance Factory method

Inner Beans 1)Can we inject Person class into others than outer class ? 2)Scope of Person class ? Can we change scope ?

IOC – Bean Lifecycle callbacks –InitializingBean & DisposableBean –Default initialization and destroy methods Callback order

IOC – Bean Aware interfaces

Testing private UserDAO userDao; public boolean auth(String user, String pass){ String encryptedPass = encrypt(pass); User user = userDao.find(user, encryptedPass); if (user != null){ return true; } return false; }

Spring Expression Language ● Querying and manipulating an object graph at runtime ● Can be used independently ● Support implementation via – API –XML –Annotation

AOP ● Aspect-Oriented Programming ● Spring AOP ● Schema-based annotation type

AOP Concepts ● Aspect ● Join Point ● Advice ● Pointcut ● Introduction ● Target object ● AOP proxy ● Weaving

AOP Type of advice –Before advice –After returning advice –After throwing advice –After (finally) advice –Around advice

AOP Pointcut types (Spring AOP)