spring.net introduction

62
Spring.NET Introduction Oliver Paulus Spring.NET Introduction Oliver Paulus 21. April 2007

Upload: oliver8951

Post on 12-Nov-2014

853 views

Category:

Documents


3 download

DESCRIPTION

Introduction to Spring.NET

TRANSCRIPT

Page 1: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring.NET Introduction

Oliver Paulus

21. April 2007

Page 2: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Table of contentsPart I / IV

1 Sample application overviewLayersAOP

2 What is Spring(.NET)?Benefits

3 Spring overview

Page 3: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Table of contentsPart I / IV

1 Sample application overviewLayersAOP

2 What is Spring(.NET)?Benefits

3 Spring overview

Page 4: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Table of contentsPart I / IV

1 Sample application overviewLayersAOP

2 What is Spring(.NET)?Benefits

3 Spring overview

Page 5: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Table of contentsPart II / IV

4 Spring object containerwithout DIP/IoC object containerwith DIP/IoC object containerFeaturesBenefits

Page 6: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Table of contentsPart III / IV

5 Spring AOPwithout AOPwith AOPAOP grammarBenefits

Page 7: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Table of contentsPart IV / IV

6 Spring WebFeatures

Page 8: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

Part I

Sample application / Spring overview

Page 9: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

Sample application overviewLayers

Page 10: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

Sample application overviewAOP

Page 11: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

What is Spring(.NET)?

Spring is a famous open source application framework forenterprise application development in Java.

The project started 2002 from infrastructure code publishedfor ”Expert One-to-one J2EE Design and Development”book ([RodJohnson]).

Spring.NET is a port of Spring for the .NET platform.

Page 12: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

What is Spring(.NET)?Benefits

modular and comprehensivecode that is easier to testnon-invasiveprovides consistent framework for data accessconsistent configurationeasy to extenddoes not reinvent the wheel...

Page 13: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

What is Spring(.NET)?Benefits

modular and comprehensivecode that is easier to testnon-invasiveprovides consistent framework for data accessconsistent configurationeasy to extenddoes not reinvent the wheel...

Page 14: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

What is Spring(.NET)?Benefits

modular and comprehensivecode that is easier to testnon-invasiveprovides consistent framework for data accessconsistent configurationeasy to extenddoes not reinvent the wheel...

Page 15: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

What is Spring(.NET)?Benefits

modular and comprehensivecode that is easier to testnon-invasiveprovides consistent framework for data accessconsistent configurationeasy to extenddoes not reinvent the wheel...

Page 16: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

What is Spring(.NET)?Benefits

modular and comprehensivecode that is easier to testnon-invasiveprovides consistent framework for data accessconsistent configurationeasy to extenddoes not reinvent the wheel...

Page 17: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

What is Spring(.NET)?Benefits

modular and comprehensivecode that is easier to testnon-invasiveprovides consistent framework for data accessconsistent configurationeasy to extenddoes not reinvent the wheel...

Page 18: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

What is Spring(.NET)?Benefits

modular and comprehensivecode that is easier to testnon-invasiveprovides consistent framework for data accessconsistent configurationeasy to extenddoes not reinvent the wheel...

Page 19: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

What is Spring(.NET)?Benefits

modular and comprehensivecode that is easier to testnon-invasiveprovides consistent framework for data accessconsistent configurationeasy to extenddoes not reinvent the wheel...

Page 20: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

SampleapplicationoverviewLayers

AOP

What isSpring(.NET)?Benefits

Springoverview

Spring overview

Page 21: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Part II

Spring object container

Page 22: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerwithout DIP/IoC object container

Page 23: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerwith DIP/IoC object container

Page 24: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerFeatures

object creation with constructor, static factory orinctance factory methodobjects as singletons or prototypes1

constructor and property injection1

possibility to set any type of property or constructorargument (null values, collections, indexer, ...)1

method injection / replacementautowiringobject lifecycle interfacetype conversionthreading and concurrency supportobject pooling...

1used in SpringSample application

Page 25: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerFeatures

object creation with constructor, static factory orinctance factory methodobjects as singletons or prototypes1

constructor and property injection1

possibility to set any type of property or constructorargument (null values, collections, indexer, ...)1

method injection / replacementautowiringobject lifecycle interfacetype conversionthreading and concurrency supportobject pooling...

1used in SpringSample application

Page 26: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerFeatures

object creation with constructor, static factory orinctance factory methodobjects as singletons or prototypes1

constructor and property injection1

possibility to set any type of property or constructorargument (null values, collections, indexer, ...)1

method injection / replacementautowiringobject lifecycle interfacetype conversionthreading and concurrency supportobject pooling...

1used in SpringSample application

Page 27: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerFeatures

object creation with constructor, static factory orinctance factory methodobjects as singletons or prototypes1

constructor and property injection1

possibility to set any type of property or constructorargument (null values, collections, indexer, ...)1

method injection / replacementautowiringobject lifecycle interfacetype conversionthreading and concurrency supportobject pooling...

1used in SpringSample application

Page 28: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerFeatures

object creation with constructor, static factory orinctance factory methodobjects as singletons or prototypes1

constructor and property injection1

possibility to set any type of property or constructorargument (null values, collections, indexer, ...)1

method injection / replacementautowiringobject lifecycle interfacetype conversionthreading and concurrency supportobject pooling...

1used in SpringSample application

Page 29: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerFeatures

object creation with constructor, static factory orinctance factory methodobjects as singletons or prototypes1

constructor and property injection1

possibility to set any type of property or constructorargument (null values, collections, indexer, ...)1

method injection / replacementautowiringobject lifecycle interfacetype conversionthreading and concurrency supportobject pooling...

1used in SpringSample application

Page 30: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerFeatures

object creation with constructor, static factory orinctance factory methodobjects as singletons or prototypes1

constructor and property injection1

possibility to set any type of property or constructorargument (null values, collections, indexer, ...)1

method injection / replacementautowiringobject lifecycle interfacetype conversionthreading and concurrency supportobject pooling...

1used in SpringSample application

Page 31: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerFeatures

object creation with constructor, static factory orinctance factory methodobjects as singletons or prototypes1

constructor and property injection1

possibility to set any type of property or constructorargument (null values, collections, indexer, ...)1

method injection / replacementautowiringobject lifecycle interfacetype conversionthreading and concurrency supportobject pooling...

1used in SpringSample application

Page 32: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerFeatures

object creation with constructor, static factory orinctance factory methodobjects as singletons or prototypes1

constructor and property injection1

possibility to set any type of property or constructorargument (null values, collections, indexer, ...)1

method injection / replacementautowiringobject lifecycle interfacetype conversionthreading and concurrency supportobject pooling...

1used in SpringSample application

Page 33: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerFeatures

object creation with constructor, static factory orinctance factory methodobjects as singletons or prototypes1

constructor and property injection1

possibility to set any type of property or constructorargument (null values, collections, indexer, ...)1

method injection / replacementautowiringobject lifecycle interfacetype conversionthreading and concurrency supportobject pooling...

1used in SpringSample application

Page 34: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerFeatures

object creation with constructor, static factory orinctance factory methodobjects as singletons or prototypes1

constructor and property injection1

possibility to set any type of property or constructorargument (null values, collections, indexer, ...)1

method injection / replacementautowiringobject lifecycle interfacetype conversionthreading and concurrency supportobject pooling...

1used in SpringSample application

Page 35: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerBenefits

less coupling between classeseasier to test codeno singleton or factory objects neededhigh pluggabilitynon-invasiveeasy to understand...

Page 36: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerBenefits

less coupling between classeseasier to test codeno singleton or factory objects neededhigh pluggabilitynon-invasiveeasy to understand...

Page 37: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerBenefits

less coupling between classeseasier to test codeno singleton or factory objects neededhigh pluggabilitynon-invasiveeasy to understand...

Page 38: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerBenefits

less coupling between classeseasier to test codeno singleton or factory objects neededhigh pluggabilitynon-invasiveeasy to understand...

Page 39: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerBenefits

less coupling between classeseasier to test codeno singleton or factory objects neededhigh pluggabilitynon-invasiveeasy to understand...

Page 40: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerBenefits

less coupling between classeseasier to test codeno singleton or factory objects neededhigh pluggabilitynon-invasiveeasy to understand...

Page 41: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring objectcontainerwithout DIP/IoCobject container

with DIP/IoC objectcontainer

Features

Benefits

Spring object containerBenefits

less coupling between classeseasier to test codeno singleton or factory objects neededhigh pluggabilitynon-invasiveeasy to understand...

Page 42: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring AOPwithout AOP

with AOP

AOP grammar

Benefits

Part III

Spring AOP

Page 43: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring AOPwithout AOP

with AOP

AOP grammar

Benefits

Spring AOPwithout AOP

Page 44: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring AOPwithout AOP

with AOP

AOP grammar

Benefits

Spring AOPwith AOP

Page 45: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring AOPwithout AOP

with AOP

AOP grammar

Benefits

Spring AOPAOP grammar

Aspect defines pointcuts and advicesAdvice is an extension or modification

Joinpoint is an event during program execution whichcan be extended or modified by advices

Pointcut defines on which joinpoints an advice will beinserted

Page 46: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring AOPwithout AOP

with AOP

AOP grammar

Benefits

Spring AOPBenefits

better SoC1

easier to understand business codehigher productivityno coupling of business code and cross cuttingconcernseasier reuse of business codeeasier to extendpossibility to delay design decisions for system (cross)level concerns

1Separation of concerns

Page 47: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring AOPwithout AOP

with AOP

AOP grammar

Benefits

Spring AOPBenefits

better SoC1

easier to understand business codehigher productivityno coupling of business code and cross cuttingconcernseasier reuse of business codeeasier to extendpossibility to delay design decisions for system (cross)level concerns

1Separation of concerns

Page 48: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring AOPwithout AOP

with AOP

AOP grammar

Benefits

Spring AOPBenefits

better SoC1

easier to understand business codehigher productivityno coupling of business code and cross cuttingconcernseasier reuse of business codeeasier to extendpossibility to delay design decisions for system (cross)level concerns

1Separation of concerns

Page 49: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring AOPwithout AOP

with AOP

AOP grammar

Benefits

Spring AOPBenefits

better SoC1

easier to understand business codehigher productivityno coupling of business code and cross cuttingconcernseasier reuse of business codeeasier to extendpossibility to delay design decisions for system (cross)level concerns

1Separation of concerns

Page 50: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring AOPwithout AOP

with AOP

AOP grammar

Benefits

Spring AOPBenefits

better SoC1

easier to understand business codehigher productivityno coupling of business code and cross cuttingconcernseasier reuse of business codeeasier to extendpossibility to delay design decisions for system (cross)level concerns

1Separation of concerns

Page 51: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring AOPwithout AOP

with AOP

AOP grammar

Benefits

Spring AOPBenefits

better SoC1

easier to understand business codehigher productivityno coupling of business code and cross cuttingconcernseasier reuse of business codeeasier to extendpossibility to delay design decisions for system (cross)level concerns

1Separation of concerns

Page 52: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring AOPwithout AOP

with AOP

AOP grammar

Benefits

Spring AOPBenefits

better SoC1

easier to understand business codehigher productivityno coupling of business code and cross cuttingconcernseasier reuse of business codeeasier to extendpossibility to delay design decisions for system (cross)level concerns

1Separation of concerns

Page 53: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring WebFeatures

Part IV

Spring Web

Page 54: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring WebFeatures

Spring WebFeatures

Dependency injection for ASP.NET pages and controls1

Master pages for ASP .NET 1.1Bidirectional data binding and model management1

LocalisationResult mapping1

Client-side scriptingValidation framework...

1used in SpringSample application

Page 55: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring WebFeatures

Spring WebFeatures

Dependency injection for ASP.NET pages and controls1

Master pages for ASP .NET 1.1Bidirectional data binding and model management1

LocalisationResult mapping1

Client-side scriptingValidation framework...

1used in SpringSample application

Page 56: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring WebFeatures

Spring WebFeatures

Dependency injection for ASP.NET pages and controls1

Master pages for ASP .NET 1.1Bidirectional data binding and model management1

LocalisationResult mapping1

Client-side scriptingValidation framework...

1used in SpringSample application

Page 57: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring WebFeatures

Spring WebFeatures

Dependency injection for ASP.NET pages and controls1

Master pages for ASP .NET 1.1Bidirectional data binding and model management1

LocalisationResult mapping1

Client-side scriptingValidation framework...

1used in SpringSample application

Page 58: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring WebFeatures

Spring WebFeatures

Dependency injection for ASP.NET pages and controls1

Master pages for ASP .NET 1.1Bidirectional data binding and model management1

LocalisationResult mapping1

Client-side scriptingValidation framework...

1used in SpringSample application

Page 59: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring WebFeatures

Spring WebFeatures

Dependency injection for ASP.NET pages and controls1

Master pages for ASP .NET 1.1Bidirectional data binding and model management1

LocalisationResult mapping1

Client-side scriptingValidation framework...

1used in SpringSample application

Page 60: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring WebFeatures

Spring WebFeatures

Dependency injection for ASP.NET pages and controls1

Master pages for ASP .NET 1.1Bidirectional data binding and model management1

LocalisationResult mapping1

Client-side scriptingValidation framework...

1used in SpringSample application

Page 61: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Spring WebFeatures

Spring WebFeatures

Dependency injection for ASP.NET pages and controls1

Master pages for ASP .NET 1.1Bidirectional data binding and model management1

LocalisationResult mapping1

Client-side scriptingValidation framework...

1used in SpringSample application

Page 62: Spring.NET introduction

Spring.NETIntroduction

Oliver Paulus

Bibliography

Spring Framework Homepage -http://www.springframework.org

Spring Framework .NET Homepage -http://www.springframework.net

Expert One-on-One J2EE Design and Development -Rod Johnson - Wrox Press - 2002

Spring in Action - Craig Walls, Ryan Breidenbach -Manning - 2005

Spring - Framework fur die Java-Entwicklung - EberhardWolff - dpunkt.verlag - 2006

Spring 2.0 im Einsatz - Guido Schmutz, PeterWelkenbach - entwickler.press - 2007

Martin Fowler Homepage - http://www.martinfowler.com