Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 19

Spring Framework Introduction Spring 3 features 1. Java 5 features 2. We now have consistent use of generic Co ections and !

aps" consistent use of generic Factor#$eans" and a so consistent reso ution of %ridge methods in the Spring &'( &(I. ist of features ) 1. Spring *+pression ,anguage 2. IoC enhancements-Java %ased %ean metadata 3. .enera /purpose t#pe conversion s#stem and fie d formatting s#stem 0 .'%1ect to 2!, mapping functiona it# 3'2!4 moved from Spring We% Services pro1ect Comprehensive 5*S6 support 7!8C additions 9ec arative mode va idation *ar # support for Java ** : *m%edded data%ase support
Spring MVC is one component within the whole Spring Framework, to support developpment of web applications. You can use an web containers, so it works fine with !omcat. "ust think that Spring is a third part librar . You #ust need to put the necessar #ar files in the lib director , and define a few $ml files. wa Spring as a whole have man modules for %&C, '&(, )eb MVC etc. %t is ver loosel coupled in such a ou can pick an of them and use in our application.

Modules 6he Spring Framework consists of features organi;ed into a%out 2< modu es. 6hese modu es are grouped into Core Container" 9ata &ccess-Integration" We%" &'( 3&spect 'riented (rogramming4" Instrumentation"

Spring !odu es )

6he Core and $eans modu es provide the fundamenta parts of the framework" inc uding the IoC and 9ependenc# In1ection features. 6he Conte+t modu e %ui ds on the so id %ase provided %# the Core and $eans modu es) it is a means to access o%1ects in a framework/st# e manner that is simi ar to a J=9I registr#. 6he *+pression ,anguage modu e provides a powerfu e+pression anguage for >uer#ing and manipu ating an o%1ect graph at runtime. It is an e+tension of the unified e+pression anguage 3unified *,4 as specified in the JS( 2.1 specification. 6he J9$C modu e provides a J9$C/a%straction a#er that removes the need to do tedious J9$C coding and parsing of data%ase/vendor specific error codes. 6he '5! modu e provides integration a#ers for popu ar o%1ect/re ationa mapping &(Is" inc uding J(&" J9'" ?i%ernate" and i$atis. 6he '2! modu e provides an a%straction a#er that supports '%1ect-2!, mapping imp ementations for J&2$" Castor" 2!,$eans" Ji$2 and 2Stream. 6he Java !essaging Service 3J!S4 modu e contains features for producing and consuming messages. 6he 6ransaction modu e supports programmatic and dec arative transaction management for c asses that imp ement specia interfaces and for all your POJOs (plain old Java objects). Spring@s Web modu e provides %asic we%/oriented integration features such as mu tipart fi e/up oad functiona it# and the initia i;ation of the IoC container using serv et isteners and a we%/oriented app ication conte+t. It a so contains the we%/re ated parts of Spring@s remoting support. 6he Web-Servlet modu e contains Spring@s mode /view/contro er 3!8C4 imp ementation for we% app ications. Spring@s !8C framework provides a c ean separation %etween domain mode code and we% forms" and integrates with a the other features of the Spring Framework. 6he Web-Struts modu e contains the support c asses for integrating a c assic Struts we% tier within a Spring app ication. =ote that this support is now deprecated as of Spring 3.<. Consider migrating #our app ication to Struts 2.< and its Spring integration or to a Spring !8C so ution. 6he Web-Portlet modu e provides the !8C imp ementation to %e used in a port et environment and mirrors the functiona it# of We%/Serv et modu e. Spring@s &'( modu e provides an AOP Alliance/comp iant aspect/oriented programming imp ementation a owing #ou to define" for e+amp e" method/interceptors and pointcuts to c ean # decoup e code that imp ements functiona it# that shou d %e separated. Asing source/ eve metadata functiona it#" #ou can a so incorporate %ehaviora information into #our code" in a manner simi ar to that of .=*6 attri%utes. 6he separate Aspects modu e provides integration with &spectJ. 6he Instrumentation modu e provides c ass instrumentation support and c ass oader imp ementations to %e used in certain app ication servers.

Spring Dependance Injection Java components - c asses shou d %e as independent as possi% e of other Java c asses. 6his increases the possi%i it# to reuse these c asses and to test them independent # of other c asses3Anit 6esting4. 6o decoup e Java components from other Java components the dependenc# to a certain other c ass shou d get in1ected into them rather that the c ass itse f creates - finds this o%1ect. 9ependanc# In1ection in spring can %e of 2 kinds & c ass & has a dependenc# to c ass $ if c ass & uses c ass $ as a varia% e. If dependenc# in1ection is used then the c ass $ is given to c ass & via 1.Constructor %ased in1ection )the constructor of the c ass & 2.Setter %ased in1ection ) a setter pu% ic c ass 6e+t*ditor B
private SpellChecker spellChecker; public TextEditor() { spellChecker = new SpellChecker(); spellChecker.checkSpelling();

*+amp es ) Constructor %ased in1ection )


public class TextEditor { private SpellChecker spellChecker; public TextEditor(SpellChecker spellChecker) { S!ste".out.println(#$nside TextEditor constructor.#); this.spellChecker = spellChecker; public void spellCheck() { spellChecker.checkSpelling();

public class SpellChecker { public SpellChecker(){ S!ste".out.println(#$nside SpellChecker constructor.# ); public void checkSpelling() { S!ste".out.println(#$nside checkSpelling.# );

i"port org.spring%ra"ework.context.&pplicationContext; i"port org.spring%ra"ework.context.support.Class'ath("l&pplicationContext; public class )ain&pp { public static void "ain(String*+ args) { &pplicationContext context = new Class'ath("l&pplicationContext(#,eans.x"l#); TextEditor te = (TextEditor) context.get,ean(#textEditor#); te.spellCheck();

,eans.x"l .bean id=#textEditor# class=#pack/01.TextEditor#2 .constructor3arg re%=#spellChecker#42 .4bean2 .533 6e%inition %or spellChecker bean 332 .bean id=#spellChecker# class=#pack/01.SpellChecker#2 .4bean2

Setter Based Injection pu% ic c ass 6e+t*ditor B


private SpellChecker spellChecker; public void setSpellChecker(SpellChecker spellChecker) { S!ste".out.println(#$nside setSpellChecker.#); this.spellChecker = spellChecker;

public SpellChecker getSpellChecker() { return spellChecker; public void spellCheck() { spellChecker.checkSpelling();

$eans.+m )
.bean id=#textEditor# class=#pack/01.TextEditor#2 .propert! na"e=#spellChecker# re%=#spellChecker#42 .4bean2 .533 6e%inition %or spellChecker bean 332 .bean id=#spellChecker# class=#pack/01.SpellChecker#2 .4bean2

Spring IOC Containers Spring $eanFactor# container ) org.springframework.%eans.factor#.$eanFactor# interface. Imp emented C ass ) 2m $eanFactor# C ass / 6his container reads the configuration metadata from an 2!, fi e and used it to create a fu # configured s#stem. / Ased for mo%i e %ased app ications and app et %ased app ications . *+amp e ) CD+m versionEF1.<F encodingEFA6F/GFDH C%eans +m nsEFhttp)--www.springframework.org-schema-%eansF +m ns)+siEFhttp)--www.w3.org-2<<1-2!,Schema/instanceF +si)schema,ocationEFhttp)--www.springframework.org-schema-%eans http)--www.springframework.org-schema-%eans-spring/%eans/3.<.+sdFH C%ean idEFhe oWor dF c assEFcom.aads.?e oWor dFH Cpropert# nameEFmessageF va ueEF?e o Wor dIF-H C-%eansH C-%eanH

package com.aadsJ pu% ic c ass ?e oWor d B private String messageJ pu% ic void set!essage3String message4 B this.message E messageJ K pu% ic void get!essage34 B KK package com.aadsJ import org.springframework.%eans.factor#.Initia i;ing$eanJ mport org.springframework.%eans.factor#.+m .2m $eanFactor#J import org.springframework.core.io.C ass(ath5esourceJ S#stem.out.print n3FLour !essage ) F M message4J

pu% ic c ass !ain&pp B B

pu% ic static void main3StringNO args4

2m $eanFactor# factor# E new 2m $eanFactor#3new C ass(ath5esource3F$eans.+m F44J ?e oWor d o%1 E 3?e oWor d4 factor#.get$ean3Fhe oWor dF4J o%1.get!essage34J KK

Spring ApplicationContext container ) org.springframework.conte+t.&pp icationConte+t It can oad %ean definitions " wire %eans together and dispense %eans upon re>uest. FileSystemXmlApplicationContext: 6his container oads the definitions of the %eans from an 2!, fi e. ?ere #ou need to provide the fu path of the 2!, %ean configuration fi e to the constructor.

ClassPat XmlApplicationContext 6his container oads the definitions of the %eans from an 2!, fi e. ?ere #ou do not need to provide the fu path of the 2!, fi e %ut #ou need to set C,&SS(&6? proper # %ecause this container wi ook %ean configuration 2!, fi e in C,&SS(&6?. We%2m &pp icationConte+t) 6his container oads the 2!, fi e with definitions of a %eans from within a we% app ication.

?e oWor d.1ava ) pu% ic c ass ?e oWor d B B K B S#stem.out.print n3FLour !essage ) F M message4J KK private String messageJ pu% ic void set!essage3String message4 this.message E messageJ pu% ic void get!essage34

!ain&pp.1ava import org.springframework.conte+t.&pp icationConte+tJ import org.springframework.conte+t.support.Fi eS#stem2m &pp icationConte+tJ pu% ic c ass !ain&pp B pu% ic static void main3StringNO args4 B &pp icationConte+t conte+t E new Fi eS#stem2m &pp icationConte+t3FC)-Asers-(ri#a-workspace-?e oSpring-src-$eans.+m F4J ?e oWor d o%1 E 3?e oWor d4 conte+t.get$ean3Fhe oWor dF4J o%1.get!essage34J KK $eans.+m

CD+m versionEF1.<F encodingEFA6F/GFDH C%eans +m nsEFhttp)--www.springframework.org-schema-%eansF +m ns)+siEFhttp)--www.w3.org-2<<1-2!,Schema/instanceF +si)schema,ocationEFhttp)--www.springframework.org-schema-%eans http)--www.springframework.org-schema-%eans-spring/%eans/3.<.+sdFH C%ean idEFhe oWor dF c assEFcom.aads.?e oWor dFH Cpropert# nameEFmessageF va ueEF?e o Wor dIF-H C-%eanH C-%eansH 6he re>uired 1ar fi es are ) ant r/runtime/3.<.1 org.springframework.aop/3.1.<.!2 org.springframework.asm/3.1.<.!2 org.springframework.aspects/3.1.<.!2 org.springframework.%eans/3.1.<.!2 org.springframework.conte+t.support/3.1.<.!2 org.springframework.conte+t/3.1.<.!2 org.springframework.core/3.1.<.!2 org.springframework.e+pression/3.1.<.!2 commons/ ogging/1.1.1

Spring Bean De!initions


6he o%1ects which are managed %# the I'C Container are ca ed $eans.6hese %eans are created %# the configuration metadata that supp ies to the container as C%ean-H (roperties c ass name -id scope 9escription 6his attri%ute is mandator# and specif# the %ean c ass to %e used to create the %ean. 6his attri%ute specifies the %ean identifier uni>ue #. In 2!,/%ased configuration metadata" #ou use the id and-or name attri%utes to specif# the %ean identifier3s4. 6his attri%ute specifies the scope of the o%1ects created from a

constructor/arg properties autowiring mode a;#/initia i;ation mode initia i;ation method destruction method

particu ar %ean definition. 6his is used to in1ect the dependencies. 6his is used to in1ect the dependencies. 6his is used to in1ect the dependencies. & a;#/initia i;ed %ean te s the IoC container to create a %ean instance when it is first re>uested" rather than at startup. & ca %ack to %e ca ed 1ust after a necessar# properties on the %ean have %een set %# the container. & ca %ack to %e used when the container containing the %ean is destro#ed.

Spring Bean Scopes Scope sing eton 9escription 6his scopes the %ean definition to a sing e instance per Spring IoC container 3defau t4. protot#pe 6his scopes a sing e %ean definition to have an# num%er of o%1ect instances. re>uest 6his scopes a %ean definition to an ?66( re>uest. 'n # va id in the conte+t of a we%/aware Spring &pp icationConte+t. session 6his scopes a %ean definition to an ?66( session. 'n # va id in the conte+t of a we%/aware Spring &pp icationConte+t. g o%a /session 6his scopes a %ean definition to a g o%a ?66( session. 'n # va id in the conte+t of a we%/aware Spring&pp icationConte+t. Spring $ean ,ife C#c e ) 6he ife c#c e of a Spring %ean is eas# to understand. When a %ean is instantiated" it ma# %e re>uired to perform some initia i;ation to get it into a usa% e state. Simi ar #" when the %ean is no onger re>uired and is removed from the container" some c eanup ma# %e re>uired. 6o define setup and teardown for a %ean" we simp # dec are the C%eanH with init/ method and-ordestro#/method parameters. 6he init/method attri%ute specifies a method that is to %e ca ed on the %ean immediate # upon instantiation. Simi ar #" destro#/method specifies a method that is ca ed 1ust %efore a %ean is removed from the container.

6o define setup and teardown for a %ean" we simp # dec are the C%eanH with init/ method and-ordestro#/method parameters. 6he init/method attri%ute specifies a method that is to %e ca ed on the %ean immediate # upon instantiation. Simi ar #" destro#/method specifies a method that is ca ed 1ust %efore a %ean is removed from the container. Initia i;ation Ca %acks ) 6he org"spring!rame#or$"%eans"!actory"Initiali&ingBean interface specifies a sing e method) void after(ropertiesSet34 throws *+ceptionJ So #ou can simp # imp ement a%ove interface and initia i;ation work can %e done inside after(ropertiesSet34 method as fo ows) pu% ic c ass *+amp e$ean imp ements Initiali&ingBean B pu% ic void a!terPropertiesSet'( B -- do some initia i;ation work K K In the case of XM)*%ased con!iguration metadata " #ou can use the init/method attri%ute to specif# the name of the method that has a void no/argument signature. For e+amp e) C%ean idEFe+amp e$eanF c assEFe+amp es.*+amp e$eanF init/methodEFinitF-H Fo owing is the c ass definition) pu% ic c ass *+amp e$ean B pu% ic void init34 B -- do some initia i;ation work

K K Destruction call%ac$s 6he org"spring!rame#or$"%eans"!actory"Disposa%leBean interface specifies a sing e method) void destro#34 throws *+ceptionJ So #ou can simp # imp ement a%ove interface and fina i;ation work can %e done inside destro#34 method as fo ows) pu% ic c ass *+amp e$ean implements Disposa%leBean B pu% ic void destro#34 B -- do some destruction work K K In the case of 2!,/%ased configuration metadata" #ou can use the destro#/ method attri%ute to specif# the name of the method that has a void no/argument signature. For e+amp e) C%ean idEFe+amp e$eanF c assEFe+amp es.*+amp e$eanF destro#/methodEFdestro#F-H Fo owing is the c ass definition) pu% ic c ass *+amp e$ean B pu% ic void destro#34 B -- do some destruction work K K

Spring Bean Post Processors


6he $ean(ost(rocessor interface defines ca %ack methods that #ou can imp ement to provide #our own instantiation ogic" dependenc#/reso ution ogic etc. Lou can a so imp ement some custom ogic after the Spring container finishes instantiating" configuring" and initia i;ing a %ean %# p ugging in one or more $ean(ost(rocessor imp ementations. Lou can configure mu tip e $ean(ost(rocessor interfaces and #ou can contro the order in which these $ean(ost(rocessor interfaces e+ecute %# setting the order propert# provided the

$ean(ost(rocessor imp ements the 'rdered interface. 6he $ean(ost(rocessors operate on %ean 3or o%1ect4 instances which means that the Spring IoC container instantiates a %ean instance and then $ean(ost(rocessor interfaces do their work. &n &pp icationConte+t automatica # detects an# %eans that are defined with imp ementation of the$ean(ost(rocessor interface and registers these %eans as post/processors" to %e then ca ed appropriate # %# the container upon %ean creation.

import org.springframework.%eans.factor#.config.$ean(ost(rocessorJ import org.springframework.%eans.$eans*+ceptionJ pu% ic c ass Init?e oWor d imp ements $ean(ost(rocessor B pu% ic '%1ect post(rocess$eforeInitia i;ation3'%1ect %ean" String %ean=ame4 throws $eans*+ception B S#stem.out.print n3F$eforeInitia i;ation ) F M %ean=ame4J return %eanJ -- #ou can return an# other o%1ect as we K pu% ic '%1ect post(rocess&fterInitia i;ation3'%1ect %ean" String %ean=ame4 throws $eans*+ception B S#stem.out.print n3F&fterInitia i;ation ) F M %ean=ame4J return %eanJ -- #ou can return an# other o%1ect as we K K

Spring Bean De!inition In eritance & chi d %ean definition inherits configuration data from a parent definition. 6he chi d definition can override some va ues" or add others" as needed. When we use 2!,/%ased configuration metadata" #ou indicate a chi d %ean definition %# using the parent attri%ute" specif#ing the parent %ean as the va ue of this attri%ute. C%eans +m nsEFhttp)--www.springframework.org-schema-%eansF +m ns)+siEFhttp)--www.w3.org-2<<1-2!,Schema/instanceF +si)schema,ocationEFhttp)--www.springframework.org-schema-%eans http)--www.springframework.org-schema-%eans-spring/%eans/

3.<.+sdFH C%ean idEFhe oWor dF c assEFpack123.?e oWor dFH Cpropert# nameEFmessage1F va ueEF?e o Wor dIF-H Cpropert# nameEFmessage2F va ueEF?e o Second Wor dIF-H C-%eanH C%ean idEFhe oIndiaF c assEFpack123.?e o=e+tF parentEFhe oWor dFH Cpropert# nameEFmessage1F va ueEF?e o IndiaIF-H Cpropert# nameEFmessage3F va ueEF=amaste IndiaIF-H C-%eanH C-%eansH

Bean De!inition +emplate We can create a $ean definition temp ate which can %e used %# other chi d %ean definitions without putting much effort. Whi e defining a $ean 9efinition 6emp ate" we shou d not specif# c ass attri%ute and shou d specif# a%stract attri%ute with a va ue of true. C%ean idEF%ean6eamp ateF a%stractEFtrueFH Cpropert# nameEFmessage1F va ueEF?e o Wor dIF-H Cpropert# nameEFmessage2F va ueEF?e o Second Wor dIF-H Cpropert# nameEFmessage3F va ueEF=amaste IndiaIF-H C-%eanH C%ean idEFhe oIndiaF c assEFpack123.?e oIndiaF parentEF%ean6eamp ateFH Cpropert# nameEFmessage1F va ueEF?e o IndiaIF-H Cpropert# nameEFmessage3F va ueEF=amaste IndiaIF-H C-%eanH 6he parent %ean cannot %e instantiated on its own %ecause it is incomp ete" and it is a so e+p icit # marked as a%stract. When a definition is a%stract ike this" it is usa% e on # as a pure temp ate %ean definition that serves as a parent definition for chi d definitions.

Spring Injecting Inner Beans Java inner c asses are defined within the scope of other c asses" simi ar #" inner %eans are %eans that are defined within the scope of another %ean. 6hus" a C%ean-H e ement inside the Cpropert#-H or Cconstructor/arg-H e ements is ca ed inner %ean C%ean idEFouter$eanF c assEF...FH Cpropert# nameEFtargetFH C%ean idEFinner$eanF c assEF...F-H C-propert#H C-%eanH

Spring Injecting Collections


We know to configure the primitive data t#pe using va ue attri%ute and o%1ect references using ref attri%ute of the Cpropert#H tag in #our $ean configuration fi e. If we want to pass the p ura as a co ection t#pes then "Spring offers four t#pes of co ection configuration e ements as * ement 9escription C istH 6his he ps in wiring ie in1ecting a ist of va ues" a owing dup icates. CsetH 6his he ps in wiring a set of va ues %ut without an# dup icates. CmapH 6his can %e used to in1ect a co ection of name va ue pairs where name and va ue can %e of an# t#pe. CpropsH 6his can %e used to in1ect a co ection of name/ va ue pairs where the name and va ue are %oth Strings We can give the su%e ements of Set" ,ist "!ap as Cva ueH and CrefH

C%ean idEc assE Cpropert# nameEFaddress,istFH C istH Cref %eanEFid1F-H Cref %eanEFid2F-H Cva ueH(akistanC-va ueH C- istH C-propert#H C-%eanH C%ean idE d1c assEH C%ean idE d2c assEH

Spring Beans Auto,iring Wiring ) Configuring the %eans in the +m fi e. &utoWiring ) Configuring according to the dependancies in the form of o%1ects. Spring I'C Container wi automatica # wi wire the dependancies which are in the form of o%1ects. It is supported on # for dependanc# %ut not for primitives and Co ections. We have earnt to dec are the %eans using the C%eanH e ement and in1ect C%eanH with using Cconstructor/argH and Cpropert#H e ements in 2!, configuration fi e. 6he Spring container can autowire re ationships %etween co a%orating %eans without using Cconstructor/argH and Cpropert#H e ements which he ps cut down on the amount of 2!, configuration #ou write for a %ig Spring %ased app ication. !ode no %#=ame 9escription 6his is defau t setting which means no autowiring and #ou shou d use e+p icit %ean reference for wiring. Lou have nothing to do specia for this wiring. &utowiring %# propert# name. Spring container ooks at the properties of the %eans on which autowire attri%ute is set to

%#6#pe at to

autodetect

%#=ame in the 2!, configuration fi e. It then tries to match and wire its properties with the %eans defined %# the same names in the configuration fi e. &utowiring %# propert# datat#pe. Spring container ooks the properties of the %eans on which autowire attri%ute is set to %#6#pe in the 2!, configuration fi e. It then tries match and wire a propert# if its t#pematches with e+act # one of the %eans name in configuration fi e. If more than one such %eans e+ists" a fata e+ception is thrown. constructor Simi ar to %#6#pe" %ut t#pe app ies to constructor arguments. If there is not e+act # one %ean of the constructor argument t#pe in the container" a fata error is raised. Spring first tries to wire using autowire %# constructor" if it does not work" Spring tries to autowire %# %#6#pe.

1.%y-ame : 6he spring container verifies whether a %ean in the container whose id is matched with the propert# to %e in1ected or not.If matched then container in1ects that %ean o%1ect into the main o%1ect %# ca ing the setter method. If no %ean is found in the container with the id as e>ua to the propert# name then that propert# remains unwired. C ass Samp e B private 9emo demoJ pu% ic void set9emo39emo demo4 B this.demoEdemoJ K pu% ic 9emo get9emo34 B return demoJ K K c ass 9emo

B -- properties --setters and getters. K C%ean idE d1c assESamp eautowire= yNa m e >

C%ean idE emo. c assE emoH 6he dependanc# is in the form of o%1ects and the %ean id and propert# name %oth are e>ua "so the container in1ects 9emo c ass o%1ect into Samp e C ass o%1ect %# ca ing the settter method. /"By+ype : 0" 0.Spring Container verifies whether a %ean c ass name configured +m and the propert# t#pe to %e in1ected are matching or not.If matched then the container in1ects the c ass o%1ect %# ca ing the setter method of the c ass. 5./HIf no c ass is matched then that propert# remains unwired. *+amp e ) pu% ic c ass Samp e B private Demo demoJ pu% ic void set9emo39emo demo4 B this.demoEdemoJ K K C%ean idE d1c assE amp eautowireE #6#peH C%ean idE d2c assE emo1 1 In a spring container "if more than ones a c ass is found which is matiching with the propert# t#pe to %e in1ected then the I'C container throwsorg"spring!rame#or$"%eans"!actory"2nsatis!iedDependancyInjecti on

0"Constructor : 6his mode is ver# simi ar to %#6#pe" %ut it app ies to constructor arguments. Spring container ooks at the %eans on which autowire attri%ute is set to constructor in the 2!, configuration fi e. It then tries to match and wire its constructor@s argument with e+act # one of the %eans name in configuration fi e. If matches are found" it wi in1ect those %eans otherwise" it wi throw e+ceptions. *g) C%ean idEFte+t*ditorF c assEFpack123.6e+t*ditorF autowireEFconstructorFH Cconstructor/arg va ueEF.eneric 6e+t *ditorF refE pe CheckerH C-%eanH CI// 9efinition for spe Checker %ean //H C%ean idEFSpe CheckerF c assEFpack123.Spe CheckerFH C-%eanH 3"Autodetect : In this t#pe ot autowiring spring container tries to work ike a constructor and if not works ike %#6#pe.It means if there is a constructor in the c ass then works ike constructor and if there is a setter in the c ass then works ike %#6#pe. /HIf a c ass contains %oth constructor and setter then 1 st preference wi %e given to construtor auto/wiring.

You might also like