Académique Documents
Professionnel Documents
Culture Documents
WhatisBeanFactoryinSpring:Chapter5|DOJSoftwareConsultant|DineshonJava
AdsbyProjectWonderful!Youradhere,rightnow:$0.70
Home
JavaFrameworks
J2EE
HadoopToturial
BuildTools
MongoDB
DesignPatterns
WebServices
JSFramework
FRIDAY,JUNE15,2012
VIEWLayers
Training
Others
ContactUs
INDUSTRIALTRAINING@DOJ
SOFTWARECONSULTANTS(P)
WhatisBeanFactoryinSpring:Chapter5
PostedbyDineshRajput
SpringBeanFactoryContainer:
ABeanFactoryislikeafactoryclassthatcontainsacollectionofbeans.TheBeanFactoryholdsBeanDefinitionsofmultiple
beanswithinitselfandtheninstantiatesthebeanwheneveraskedforbyclients.
BeanFactoryisabletocreateassociationsbetweencollaboratingobjectsastheyareinstantiated.Thisremovesthe
burdenofconfigurationfrombeanitselfandthebeansclient.
BeanFactoryalsotakespartinthelifecycleofabean,makingcallstocustominitializationanddestructionmethods.
ThisisthesimplestcontainerprovidingbasicsupportforDIanddefinedbytheorg.springframework.beans.factory.BeanFactory
interface.TheBeanFactoryandrelatedinterfaces,suchasBeanFactoryAware,InitializingBean,DisposableBean,arestill
presentinSpringforthepurposesofbackwardcompatibilitywiththelargenumberofthirdpartyframeworksthatintegratewith
Spring.
POPULARPOSTS
Spring3.0MVCwith
Hibernate3.0CRUD
Example
Inthisexampleshowhowto
writeasimplewebbased
applicationwithCRUD
operationusingSpring3MVCFramwork
withHibernate3usingAnnot...
RESTandSOAPWebServiceInterview
Questions
Inthisinterviewquestionstutorialwewill
explainmostaskinginterviewsquestions
onthewebserviceslikeSOAP,RESTetc
anditsproto...
CoreJAVATutorialCore
JAVAaBabySteptobea
BestJavaian
HelloFriends,Nowwewill
focusedontheCoreJava
tutorial,itisreallyababy
steptobeagood,betterandbestJavaian
:).I...
HowdoesjavaHashmap
workinternally
WhatisHashing?Hashing
initssimplestform,isaway
toassigningauniquecode
foranyvariable/objectafter
applyinganyformula/algo...
Triangle.java
viewplain
01.
02.
03.
04.
05.
06.
07.
08.
09.
packagecom.sdnext.dineshonjava.beanfactory.tutorial;
publicclassTriangle
{
publicvoiddraw()
{
System.out.println("DrawingTriangle");
}
}
SpringTutorialSpring3.0
aBabySteptoLearn
Inthisseriesofspring
tutorials,itsprovidesmany
stepbystepexamplesand
explanationsonusing
Springframework.TheSpringframew...
DineshOnJava
spring.xml
viewplain
01.
02.
03.
04.
05.
06.
1,768likes
print
<beansxmlns:aop="http://www.springframework.org/schema/aop"xmlns:p="http://www.springframework.org/sch
ema/p"xmlns:security="http://www.springframework.org/schema/security"xmlns:tx="http://www.springframew
ork.org/schema/tx"xmlns:xsi="http://www.w3.org/2001/XMLSchema
instance"xmlns="http://www.springframework.org/schema/beans"xsi:schemalocation="http://www.springframe
work.org/schema/beanshttp://www.springframework.org/schema/beans/springbeans2.5.xsd
http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spri
ngcontext2.5.xsd
http://www.springframework.org/schema/securityhttp://www.springframework.org/schema/security/sprin
gsecurity2.0.4.xsd
http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/springaop
2.5.xsd
http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/springtx
2.5.xsd">
http://www.dineshonjava.com/2012/06/whatisbeanfactoryinspring.html#.Vfb_w9yqqko
LikePage
ContactU
Bethefirstofyourfriendstolikethis
LABELS
About My Professional Life (1) AJAX (4)
1/4
9/14/2015
WhatisBeanFactoryinSpring:Chapter5|DOJSoftwareConsultant|DineshonJava
07.
08.
09.
10.
<beanclass="com.sdnext.dineshonjava.beanfactory.tutorial.Triangle"id="triangle">
</bean>
</beans>
Drawing.java
JAVA(59)GarbageCollection(2) GitHub
Gradle(3) Hadoop(14) Hibernate (2) hibernate4
(4) interview questions (1) Java(10)JavaMail
JAXB (4) JDBC (1) JSP (29)
JSTL
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
multithreading (16)
(18)Servlet(25) SOAP(9) SpringBatch
(17) Spring Batch3 (1) Spring3.0
Spring4 (7) SpringSecurity (12) String in
Java(31)struts2(49)thymeleaf
motivational (1)
packagecom.sdnext.dineshonjava.beanfactory.tutorial;
importorg.springframework.beans.factory.BeanFactory;
importorg.springframework.beans.factory.xml.XmlBeanFactory;
importorg.springframework.core.io.FileSystemResource;
/**
*@authorDineshRajput
*
*/
publicclassDrawingApp
{
/**
*@paramargs
*/
publicstaticvoidmain(String[]args)
{
//Triangletriangle=newTriangle();
BeanFactoryfactory=newXmlBeanFactory(newFileSystemResource("spring.xml"));
Triangletriangle=(Triangle)factory.getBean("triangle");
triangle.draw();
}
}
(1) WebService(9)WSDL(9)
SENDYOURQUERY
Name
Email*
Message*
Therearefollowingtwoimportantpointstonoteaboutthemainprogram:
Send
1. FirststepistocreatefactoryobjectwhereweusedframeworkAPIXmlBeanFactory()tocreatethefactorybeanand
ClassPathResource()APItoloadthebeanconfigurationfileavailableinCLASSPATH.TheXmlBeanFactory()APItakes
careofcreatingandinitializingalltheobjectsie.beansmentionedintheconfigurationfile.
2. SecondstepisusedtogetrequiredbeanusinggetBean()methodofthecreatedbeanfactoryobject.Thismethoduses
beanIDtoreturnagenericobjectwhichfinallycanbecastedtoactualobject.Onceyouhaveobject,youcanusethis
objecttocallanyclassmethod.
4 0 8 9 8 2 6
Follow@dineshonjava
AfterruntheDrawingclasswewillgetfollowingOutputonconsole.
Output:
Jun17,20123:47:36PMorg.springframework.beans.factory.xml.XmlBeanDefinitionReaderloadBeanDefinitions
INFO:LoadingXMLbeandefinitionsfromfile[F:\myworkspace\spring03BeanFactoryDemo\spring.xml]
DrawingTriangle
MENU
2015(12)
2014(89)
2013(352)
2012(85)
December(30)
November(1)
October(1)
July(20)
June(22)
BeanDefinitionInheritanceinSpring:
Chapter13...
InNextChapterwewilldiscusssameexampleusingApplicationContextContainer.
UsingApplicationContextAwarein
Spring:Chapter...
PrototypeBeanScopewithAnnotation
SingletonBeanScopeinSpring
<<Previous||Next>>
SpringAutowiringbyAutoDetect
SpringAutowiringbyConstructor
BeanScopesinSpring:Chapter11
SpringAutowiringbyType
SpringAutowiringbyName
85
BeanAutowiringinSpring:Chapter10
InjectingCollectioninSpring:Chapter9
InjectingInnerBeansinSpringwith
Example:Cha...
Constructor&SetterandObjectInjecting
:Chapte...
ApplicationContextinSpring:Chapter6
WhatisBeanFactoryinSpring:Chapter
5
SpringIoCContainerChapter4
HelloWordExampleinSpring:Chapter
3
SettingupEnvironmentofSpring:
Chapter2
DependencyInjectioninSpring:
Chapter1
http://www.dineshonjava.com/2012/06/whatisbeanfactoryinspring.html#.Vfb_w9yqqko
2/4
9/14/2015
WhatisBeanFactoryinSpring:Chapter5|DOJSoftwareConsultant|DineshonJava
1Comment
dineshonjava
Recommend
Share
Login
SortbyBest
ComputerTerminologies
WhoisWhoinComputerArea
HibernateBatchProcessing:Chapter
34
May(7)
Jointhediscussion
March(4)
AmolJadhav ayearago
Pleaseexplainindetails
Reply Share
WHAT'STHIS?
ALSOONDINESHONJAVA
SpringAOPTtransactionManagementin
Hibernate
Synchronizedblock|DAVJavaServices
1comment2yearsago
2comments2yearsago
RajendraWecanremovesynchronizedfromthe
displaymethoddeclarationasweare
synchronizingthisobjectonthecallerside.It's
MallikarjunReddyKamireddywelearnalotfrom
yoursitewereallysaysthankstoyou.
AJAXIntroduction|DAVJavaServices
DifferencebetweenTreeMapvsHashMap|DAV
JavaServices
2commentsayearago
DineshRajputThanksSaquibforresponse.
1comment2yearsago
Dinesh
BijoyHashMapissynchronizedwhileitisbeing
lookedup.what"lookedup"means??
Subscribe
AddDisqustoyoursite
NewerPost
Privacy
Home
OlderPost
Subscribeto:PostComments(Atom)
AdsbyProjectWonderful!Your
adhere,rightnow:$0.30
ADS
AdsbyProjectWonderful!Youradhere,rightnow:$0
AdsbyProjectWonderful!Youradhere,rightnow:$0.05
AdsbyProjectWonderful!Youradhere,rightnow:$0.20
POPULARPOSTS
Spring3.0MVCwithHibernate3.0CRUDExample
Inthisexampleshowhowtowriteasimplewebbasedapplicationwith
CRUDoperationusingSpring3MVCFramworkwithHibernate3using
Annot...
SpringTutorialSpring3.0aBabySteptoLearn
http://www.dineshonjava.com/2012/06/whatisbeanfactoryinspring.html#.Vfb_w9yqqko
3/4
9/14/2015
WhatisBeanFactoryinSpring:Chapter5|DOJSoftwareConsultant|DineshonJava
Inthisseriesofspringtutorials,itsprovidesmanystepbystepexamplesand
explanationsonusingSpringframework.TheSpringframew...
CoreJAVATutorialCoreJAVAaBabySteptobeaBestJavaian
HelloFriends,NowwewillfocusedontheCoreJavatutorial,itisreallyababy
steptobeagood,betterandbestJavaian:).I...
SpringSecurityTutorialtakeaBabysteptobeSecure
Inthisspringsecuritytutorialwewilldiscussaboutsomeofthesecuritytips
abouttheSpringFramework.SpringSecurityisapowerfula...
HowdoesjavaHashmapworkinternally
WhatisHashing?Hashinginitssimplestform,isawaytoassigningaunique
codeforanyvariable/objectafterapplyinganyformula/algo...
RESTandSOAPWebServiceInterviewQuestions
Inthisinterviewquestionstutorialwewillexplainmostaskinginterviewsquestionsonthe
webserviceslikeSOAP,RESTetcanditsproto...
Struts2Hibernate3IntegrationExamplewithSpring3
InthisexamplewewilldescribetheintegrationofStruts2withHibernate3as
wellasusingSpring3andTiles2inthisexample.Werecomme...
SpringSecurityLoginFormUsingDatabase
Inthistutorialwewilldiscusssamepreviousexampleofcustomloginformfor
authenticationbutdifferenceisthatonlyweusingdatabas...
SpringWebMVCFramework:Chapter38
Modelviewcontrollerisasoftwarearchitecturedesignpattern.Itprovides
solutiontolayeranapplicationbyseparatingthreecon...
HibernateTutorialHibernate3onBabySteps
ThishibernatetutorialprovidestepbystepinstructionsonusingHibernate
3.0.Hibernateispopularopensourceobjectrelationalma...
http://www.dineshonjava.com/2012/06/whatisbeanfactoryinspring.html#.Vfb_w9yqqko
LiveTrafficFeed
AvisitorfromSanFrancisco,
UnitedStatesviewed
RESTfulWebServiceswith
JerseyJAXRS...47secs
AvisitorfromIndiaviewed
ago
HowdoesjavaHashmap
workinternally|...1minago
AvisitorfromSanFrancisco,
UnitedStatesviewedJava
tutorial,Springtutorial,
Hibernat...1minago
AvisitorfromIndiaviewed
Struts2Hibernate3
IntegrationExample...1min
AvisitorfromNasik,India
ago
viewedRESTandSOAP
WebServiceInterview
AvisitorfromParis,France
Ques...2minsago
viewedManyToOne
MappinginHibernate:
AvisitorfromFrankfurtAm
Chapt...2minsago
Main,Germanyviewed
SpringBatchItemReaderand
ItemWriterE...3minsago
AvisitorfromAlmaty,
KazakhstanviewedSpring
CRUDExampleusingOne
AvisitorfromJundia,Brazil
toOneMap...3minsago
viewedRESTfulWeb
ServiceswithJerseyJAXRS
AvisitorfromPune,India
...3minsago
viewedSpringCRUD
ExampleusingManytoOne
AvisitorfromBhandup,
Ma...4minsago
IndiaviewedJavatutorial,
Springtutorial,Hibernat...5
AvisitorfromSanFrancisco,
minsago
UnitedStatesviewedCore
JAVATutorialCoreJAVA
aBabySt...5minsago
AvisitorfromDublin,
IrelandviewedSpring
CRUDExampleusingOne
AvisitorfromRoseHill,
toOneMap...5minsago
MauritiusviewedSpring
MVCviewlayerThymeleaf
AvisitorfromIndiaviewed
vs.JSP...5minsago
RealtimeviewGetFeedjit
4/4