Spring Tutorial 04 - Writing Code Using the Bean Factory

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024

Комментарии • 171

  • @pratik2861
    @pratik2861 4 года назад +62

    For all new viewers, as xmlBeanFactory is deprecated use Application Context instead, explained in next video.

  • @AT-vm2jh
    @AT-vm2jh 3 года назад +17

    This tutorial is great and definitely needs an update to an recent versions of Spring. I hope you will find time to make some soon. Thanks for your amazing work!

  • @kaiwalyapowle7804
    @kaiwalyapowle7804 2 года назад +2

    This video is still relevant because even if we don't use the old framework much, we need to understand the configuration and basic concepts in order to know the latest framework and how the latest framework bypasses all the tedious configuation.

  • @MukulTripathi
    @MukulTripathi 13 лет назад +1

    Seen all four as soon as they came out... waiting for more... Excellent tutorials!

  • @MDehran
    @MDehran 10 лет назад

    This is simplest and clear example i saw to create bean using bean factory and its implementation classes. thanks

  • @stokescomp
    @stokescomp 12 лет назад +1

    I followed your tutorial and it worked the first time!! It does mention that XmlBeanFactory is deprecated. I have fixed it using this line: ApplicationContext factory= new ClassPathXmlApplicationContext("spring.xml"); instead of: BeanFactory factory = new XmlBeanFactory(new FileSystemResource("spring.xml"));
    Thanks for the great tutorial.

    • @stokescomp
      @stokescomp 2 года назад

      Glad I was able to help 9 years in the past! Good luck!

  • @funkybuddha1598
    @funkybuddha1598 4 года назад

    Please donot delete these tutorials!!

  • @Java.Brains
    @Java.Brains  13 лет назад +1

    @roshansalvi81 Hope you've seen the other tutorials on my channel. I cover Spring annotations in considerable detail.

  • @linchenSeth
    @linchenSeth 5 лет назад +2

    For the latest version of Spring, the Spring.xml should be under the src directory to get rid of the No bean available exception :)

  • @rav8149
    @rav8149 10 лет назад +1

    If you're getting classnot found then
    this is the right way in spring.xml
    This will work

  • @santubudhe2
    @santubudhe2 13 лет назад

    i got spring setup in eclipse, now i can give a high level description about dependence injection, need for bean factory and how spring is helping avoid dependence between classes. thank you very much.

  • @JitendraDas62075
    @JitendraDas62075 5 лет назад +3

    If someone is getting problem with DTD xml format then they can try the XSD XMl format as shown below:

    • @Rhyzal_
      @Rhyzal_ 4 года назад

      Thank you so much! This solved my problem!

  • @stokescomp
    @stokescomp 12 лет назад +3

    When I used the ApplicationContext I also had to move the spring.xml file into the src folder in the project instead of the project folder.

  • @ureachsenthil2
    @ureachsenthil2 10 лет назад

    Thank you very much for taking time and effort to put this wonderful and useful tutorial. It is very simple and easy to follow. Love your teaching skills!

  • @hensshad4832
    @hensshad4832 8 лет назад +22

    The XmlBeanFactory is deprecated. The better alternative is using ClassPathXmlApplicationContext as follow:
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");

    • @michaelpoznecki3033
      @michaelpoznecki3033 6 лет назад +4

      I am trying this, but I keep getting "File does not exist" error for spring.xml

    • @ramkethireddy9445
      @ramkethireddy9445 6 лет назад +8

      need to put the xml file under src folder

    • @VenkateshMogili
      @VenkateshMogili 6 лет назад

      Thank you Ram, it got solved...

    • @dev-skills
      @dev-skills 5 лет назад +1

      _ApplicationContext_ uses *eager loading* whereas _BeanFactory_ used *lazy loading* . It includes all functionality of _BeanFactory_ and more. For most of the enterprise applications, _ApplicationContext_ is preferred. Use as below:
      ApplicationContext context=new ClassPathXmlApplicationContext("springs.xml");

    • @krishnasomayajulu4963
      @krishnasomayajulu4963 5 лет назад

      @@ramkethireddy9445 Correct, it worked well.Thanks

  • @Java.Brains
    @Java.Brains  12 лет назад

    My guess is that Spring is not able to find the class Triangle that you've mapped for bean name "triangle". Have you double-checked the package name, class name for typos?

  • @saurabhgangamwar8290
    @saurabhgangamwar8290 4 года назад

    thank you so much.i have learned lot of things from your videos.

  • @vitezkoja6949
    @vitezkoja6949 8 лет назад +40

    If someone use maven for this project: 1. spring.xml need to be in folder res/main/resources and 2. in DrawingApp main metod should be like this:
    // BeanFactory factory = new ClassPathXmlApplicationContext("spring.xml");
    //Triangle triangle = (Triangle) factory.getBean("triangle");
    //triangle.drawn();

  • @kiphill5447
    @kiphill5447 11 лет назад

    Great Educator. Your instructions are concise and very helpful.

  • @nikhidas23
    @nikhidas23 12 лет назад

    Awewsome Koushik ! Thank you so much for sharing your knowledge

  • @Raind3ad
    @Raind3ad 10 лет назад +9

    XmlBeanFactory is deprecated in the latest version but you could try it this way (Like in the next Tutorial 05 ):
    //Gets the resource
    ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
    Triangle triangle = (Triangle) context.getBean("triangle");
    triangle.draw();
    //Closes the context
    ( (ClassPathXmlApplicationContext) context ).close();

  • @fatiheneskose4477
    @fatiheneskose4477 5 лет назад +1

    Use ClassPathXmlApplicationContext instead of XmlBeanFactory for new versions

  • @CHeRNoRMX
    @CHeRNoRMX 8 лет назад

    I like your english, especially the gaps between the words... "we're doing a (pause) bean", "you get a (pause) Triangle)"... once again, thanks for the great tutorial.

  • @SushantKumar-ev5uh
    @SushantKumar-ev5uh 2 года назад +1

    XmlBeanFactory is deprecated . You videos are great but please update them.

  • @garytimeless7251
    @garytimeless7251 3 года назад

    I am going to write an exam about software architecture tomorrow - thx for your nice explanation.

  • @fagonas
    @fagonas 12 лет назад

    Thank you so much! you lighten my life.

  • @muzzammilayyubi6944
    @muzzammilayyubi6944 10 лет назад

    Very clean and clear tutorial. Awesome

  • @zebashabnam4962
    @zebashabnam4962 5 лет назад +2

    In my case its depriccating the XmlBeanFactory

  • @muhammadzaman9804
    @muhammadzaman9804 2 года назад +1

    Nothing works. I am doing projects on all your work but unfortunately nothing works. Errors and Errors and Errors.

  • @pallavimanan4124
    @pallavimanan4124 5 лет назад +3

    If you're getting the below exceptions, do the following:
    1. Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring.xml] cannot be opened because it does not exist
    Solution: Write the fully qualified name of the spring.xml file, e.g. ApplicationContext factory= new ClassPathXmlApplicationContext("\\org\\pallavi\\spring\\spring.xml");
    2. org.xml.sax.SAXParseException; Content is not allowed in trailing section.
    Solution: When you're copying the contents of ApplicationContext.xml from some other website, it copies some other invisible characters too. You should create it fresh without copy-pasting so that extra characters are not added to the XML.
    e.g.
    Since I am using spring 5.1.1, I replaced 2.0 with 5.1.1 and it worked for me!
    Hope it helps! :)
    Thank you

    • @AkashSingh-el1ew
      @AkashSingh-el1ew 5 лет назад +1

      for BeanDefinitionStoreException, we would see in error description, something like, parsing XML document from file[location], for me i had to include 'src\\', we .......what I am trying to say is, we can always use the location to find the location of xml file in local disk, which can be used accordingly :)

    • @Lycheeee11
      @Lycheeee11 5 лет назад

      This really helped me! Thanks!

  • @vivekcg519
    @vivekcg519 9 лет назад +6

    Guys, XMLBeanFactory is depricated.So, Use:
    DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    BeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
    reader.loadBeanDefinitions(new FileSystemResource("Spring.xml"));

  • @donoi2k22
    @donoi2k22 9 лет назад

    Make sure there's no blank space after , otherwise big fat exception.

  • @chrismartin16cm
    @chrismartin16cm 4 года назад +2

    I'm getting a "XmlBeanDefinitionStoreException"

  • @sumanshrestha834
    @sumanshrestha834 8 лет назад +5

    XmlBeanFactory is depreciated what does it means when we are import it it shows that msg

  • @kenilpatel7841
    @kenilpatel7841 2 года назад

    Loved this

  • @xh3992
    @xh3992 9 лет назад +5

    Great tutorial, it would be better if the project is first created as Maven project though

  • @nezz0r
    @nezz0r 6 лет назад

    The tutorial series is good but no matter how I think about it I still do not see any advantage in using Spring for creating objects.
    Can someone explain to me the advantage?

  • @omocal4u
    @omocal4u 11 лет назад

    Great tutorial, clear and precise. A quich question is can I use hibernate in a stand alone application?

  • @amanvikram04
    @amanvikram04 7 лет назад +1

    why i am getting suppress warning annotations?

  • @danishrubhan3884
    @danishrubhan3884 Год назад

    Error occurred during initialization of boot layer
    java.lang.module.FindException: Module spring.beans not found, required by SpringDemo

  • @josselynmunoz8743
    @josselynmunoz8743 5 лет назад +1

    "...why are we performing this circus act..." haha

  • @sweetztcs
    @sweetztcs 12 лет назад

    Hi, I tried implementing the above program but it shows the error as "XmlBeanFactory is deprecated". Can you please tell me why it shows this?

  • @chandrakanthdudela5515
    @chandrakanthdudela5515 9 лет назад +2

    Hi, I created the spring.xml under the root as you have explained but it showed me a IOExceptoin saying it couldn't find the XML file. I copied it under the 'src' folder and it worked. Is there any reason behind it?

    • @victort.5040
      @victort.5040 8 лет назад +1

      +chandra kanth I think because we use ClassPathXmlApplicationContent() instead, it doesn't allow pass FileSystemResource variable. The path of FileSystemResouce is /, but that of ClassPathXmlApplicationContent is /src/ +Java Brains is it correct?

    • @lemonginger001
      @lemonginger001 7 лет назад

      Can u elobarate more

    • @aparnaganguri8066
      @aparnaganguri8066 6 лет назад

      Even I encountered with same exception java.io.FileNotFoundException. I copied xml file under 'src' folder,but still i am getting same Exception. i appreciate your help ...Thank You

  • @ravenblizzard
    @ravenblizzard 11 лет назад

    A little tip: Ctr+Shift+O will do all your imports at once.

  • @praslisa
    @praslisa 8 лет назад

    awesome tutorial!! thank you!!

  • @ambikabc
    @ambikabc 12 лет назад

    @Koushks : I have a doubt. If the spring.xml file has say like 100 entries meaning 100 classes.
    Does that mean we need to remember the names of all those classes in case we have to create an object of a particular class in DrawingApp? (like for example we create triangle object).

  • @musicLover29102011
    @musicLover29102011 11 лет назад

    I am learning Spring framework and videos are very helpful for me. In this video, you have used Factory pattern for creating objects and so you have a brand new object whenever you call getBean(id) api. Is there a way to return an already created object if the same id is passed again?

  • @helipilot727
    @helipilot727 8 лет назад

    I'm not following what was accomplished. You moved the new Triangle() out of code and into a config to avoid a code dependency on Triangle(), but then used Triangle in the method anyway, to store the reference from getBean(). So the code is still dependent on on Triangle(). So you added a spring config file, third party library (spring framework), effectively moved a possible compile time error to a run time error, all to eliminate the "new" keyword?

    • @Java.Brains
      @Java.Brains  8 лет назад +1

      +flgliderpilot Not just new. The idea is to have the class depend on an interface and not an implementation. Having moved the new out of the class and into config, we now have the flexibility to supply a new instance of any class that implements that interface.

    • @shinigami0018
      @shinigami0018 8 лет назад

      +flgliderpilot I agree with you. As for Triangle object, to be fully independent of any concrete type, I guess you would better use Shape Class, and then call shape.draw(), that way your class wouldn't be dependent on any concrete class.

  • @ccosborn2000
    @ccosborn2000 10 лет назад

    Is this just for ECLIPSE? I do not see a BeanFactory in NetBeans.

  • @aayushagrawal24
    @aayushagrawal24 6 лет назад

    i have added all the reqiured jar files, but still beanfactory interface and xmlbeanfactory classes are not getting resolved. sumone pls help

  • @AkeshwarJha
    @AkeshwarJha 9 лет назад +4

    Hi, when I try to import org.springframework.beans.factory.xml.XmlBeanFactory, it says that XmlBeanFactory is deprecated. Using spring 4.2.0
    Kindly resolve!

    • @thijs-de-haan
      @thijs-de-haan 9 лет назад

      +Akeshwar Jha stackoverflow.com/questions/5231371/springs-xmlbeanfactory-is-deprecated#answer-9210939

  • @pranneetthbheemisetty8685
    @pranneetthbheemisetty8685 8 лет назад

    I have did exactly the same what is done in the tutorial except that i have ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(
    new String[] {"spring.xml"});
    in place of XmlBeanFactory. But when i run the program its not printing anything on console..its completely blank. Please help me!

  • @jain7497
    @jain7497 6 лет назад

    Really excellent

  • @ViswanathanRanganathan
    @ViswanathanRanganathan 11 лет назад

    Are there any other means of configuring the bean factory other than using XMLBeanFactory?...Just curious!

  • @roshansalvi81
    @roshansalvi81 13 лет назад

    Very good explanation. But I was looking out for spring 3.0 examples with annotation.

  • @ambarbs
    @ambarbs 10 лет назад

    Thanks a lot for making this tutorial!

  • @jahanavilagadapati2706
    @jahanavilagadapati2706 9 лет назад

    i'm getting class not found exception for the program when i tried how to build it?

  • @ujjawalgupta8799
    @ujjawalgupta8799 5 лет назад

    I can't import those spring factory library in my class.... I have added the spring factory jars as specified in the video... But diffrnt version

  • @adarshverma3372
    @adarshverma3372 3 года назад

    if someone is using the maven then add the spring.xml in the src/main/resources

  • @niharikapatnaik1199
    @niharikapatnaik1199 4 года назад +1

    can u pls tell how we can get those info level messages on the console? pls i'm struggling to get that since 6 months.

    • @niharikapatnaik1199
      @niharikapatnaik1199 4 года назад +1

      Finally got the answer, after almost a year. I needed to use the earlier version of springs; used 4.2.2 instead of 5.2.2. Now I can see the info logs in the console

  • @andrewshenka
    @andrewshenka 10 лет назад

    Yes, in last version Spring 4 XmlBeanFactory is cross out.

  • @chrismartin16cm
    @chrismartin16cm 4 года назад +1

    I'm also using Netbeans IDE

  • @TheSridharraj
    @TheSridharraj 10 лет назад +1

    Will you please update all the videos with the latest spring version?

  • @AminHasan85
    @AminHasan85 9 лет назад

    Great example. thx

  • @mohnishpwr10
    @mohnishpwr10 2 года назад

    From where to get the code ?

  • @parthsalat3915
    @parthsalat3915 2 года назад +1

    Please give us the Doctype code!

  • @meytal-3478
    @meytal-3478 4 года назад

    Awesome

  • @sudipupadhyay6935
    @sudipupadhyay6935 6 лет назад

    if we do factory.getBean("triangle",Triangle.class) i dont think we need to type cast it.

  • @RickyRicheRebelle
    @RickyRicheRebelle 6 лет назад +1

    as many others i'm getting the annoying arror msg: class path resource [spring.xml] cannot be opened because it does not exist while I did everything shown in the video. as the methods are deprecated in newest releases, I changed BeanFactory etc into :
    BeanDefinitionRegistry factory = new DefaultListableBeanFactory();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory);
    reader.loadBeanDefinitions(new ClassPathResource("spring.xml"));
    Triangle tri1 = (Triangle) ((DefaultListableBeanFactory) factory).getBean("tri1");
    in the XML file, it seems that the standard has changed as well (since when i put DOCTYPE in it, eclipse immediately shows me multiple errors, while without DOCTYPE I'm not getting any error msg). instead of DOCTYPE I looked up official notes and implemented the following lines:
    but still not working. why my spring.xml does not exist ? can't understand. If anyone knows what's wrong I'll appreciate that tnx

    • @ihor3729
      @ihor3729 6 лет назад

      try to write full path to the spring.xml For example: /org/koushik/javabrains/Spring.xml in DrawingAppClass

    • @RickyRicheRebelle
      @RickyRicheRebelle 6 лет назад

      possible solution. but actually after searching I found that if the xml is defined directly in the current package of the src folder then everything works fine. otherwise we need to put the xml into a special folder (as in the case of boot projects). I still can't figure out how could his project in the video works with that xml defined at project level...

    • @pallavimanan4124
      @pallavimanan4124 5 лет назад +1

      Use this:
      Since I am using spring 5.1.1, I replaced 2.0 with 5.1.1 and it worked for me!
      Thanks!

    • @tianyangren
      @tianyangren 5 лет назад

    • @abhijeetzade3336
      @abhijeetzade3336 5 лет назад +1

      @@pallavimanan4124 thanks mam now it works

  • @gauravsingh-nt2bs
    @gauravsingh-nt2bs 11 лет назад

    xml document from class path resource is invalid.. :(

  • @shashgo
    @shashgo 7 лет назад

    koushik @javabrains You put the spring jars and the common logging utilities in a spring folder in the project by right clicking on the project, going to properties ..... and creating a user library. How about if instead of creating a new user library, we right just add the external jar libraries under the libraries tag, would everything still work.
    Also, yes I know that XmlBeanFactory is deprecated in favour of ApplicationContext, but shouldn't a deprecated tag still work?

    • @Deocampo3
      @Deocampo3 7 лет назад

      In regards to the deprecated tag question, Yes it will work, I tried it for Spring v-3.2.0.

  • @CoLinearProductions
    @CoLinearProductions 9 лет назад

    is this deprecated?

  • @leddel746
    @leddel746 11 лет назад

    it was awesome learning this.

  • @kalyanipatel1255
    @kalyanipatel1255 10 лет назад

    Hi Kaushik,
    Thanks a lot for these wonderful tutorials, these are really helpful.
    I had one question, I see tutorial bundles which got most hits in utube are of urs.
    So it must be good :) and thats not only for one framework , starting from servlet to spring, hibernet and more
    I just wonder how many framework have you mastered ...
    Just one thing these tutorials are very very helpful.
    I am done with 2 of the framework , thanks to u
    Is there any tutorials which is in more depth , or with some assignments which u can suggest
    Thanks again mate

  • @malbrantj
    @malbrantj 9 лет назад

    Really good tutorial!

  • @ch1n089
    @ch1n089 12 лет назад

    you work is with MVC?
    thx

  • @abarag8
    @abarag8 6 лет назад

    In Spring v 5.0, BeanFactory is deprecated. Use below alternative for BeanFactory:
    BeanDefinitionRegistry factory = new DefaultListableBeanFactory();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory);
    reader.loadBeanDefinitions(new ClassPathResource("spring.xml"));
    Triangle triangle = (Triangle) ((DefaultListableBeanFactory) factory).getBean("triangle");
    triangle.draw();

  • @JimitRupani
    @JimitRupani 7 лет назад

    Why i am getting Calss not found exception error on the same code?

  • @richardlarancuente7377
    @richardlarancuente7377 3 года назад

    The dependencies can be found from here
    repo.spring.io/release/org/springframework/spring/ [Spring jar] => Select the approriate version
    commons.apache.org/proper/commons-logging/download_logging.cgi [Apache jars] => Inside zip/tar file

  • @nikeshshetty7814
    @nikeshshetty7814 9 лет назад

    That was really great Java Brains Can you please add some comments with respect to changes in latest spring It would be helpful.
    I know the effort of uploading the new video, so comments would be really helpful.
    Thanks

  • @PawanSRAO-fk7vd
    @PawanSRAO-fk7vd 8 лет назад

    Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from file . Can anyone help me resolve this error?

  • @ZACK-mp7ek
    @ZACK-mp7ek 3 года назад

    Error: Unable to initialize main class com.edureka.springbootdemo.DrawingApp
    Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext
    help me anyone

  • @RonnyKibet
    @RonnyKibet 8 лет назад +2

    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
    Works.

  • @TheGuroguro12
    @TheGuroguro12 7 лет назад

    Thank you very much.

  • @cpandit803
    @cpandit803 12 лет назад

    10:03 I really thought of having that question raised in my mind
    WhyTF are u doing so many things for just having an output which is "SAME AS EARLIER"
    "Kaan ulte haath se kyun pakdte ho jab wahi milne wala hai yaara? ^_^"

  • @m0kter
    @m0kter 9 лет назад

    thanks for the videos

  • @kartiktamtaincupdates
    @kartiktamtaincupdates 7 лет назад

    where to put spring.xml in netbeans in my case it is not reconizing it

    • @azuhiru
      @azuhiru 7 лет назад

      maybe it's late but... you have to put the spring.xml file in the /src folder

    • @archi7373
      @archi7373 7 лет назад

      In that, it is asking to select from:- 1.Well formed Document,2.DTD Constrained Document,3.XML schema constrained document.Which one of them am i supposed to select?

    • @archi7373
      @archi7373 7 лет назад

      In that, it is asking to select from:- 1.Well formed Document,2.DTD Constrained Document,3.XML schema constrained document.Which one of them am i supposed to select?

  • @programm.r
    @programm.r 9 лет назад

    I've downloaded the newest version of spring -version 4.1.6. I tried the code that was suggested within the comments below as a solution to the deprecated XmlBeanFactory, and unfortunately, that code failed to execute. Would someone be able to explain how to do all the steps in this tutorial using the latest version?

    • @sudysona
      @sudysona 9 лет назад

      Robyn Silber So I just did the same steps as told in the tutorial with 4.1.6 and it worked fine. I assume you are using Java 1.6 and above. What happens when you try to run the code? Is there a compile time problem?

    • @ittejes
      @ittejes 9 лет назад

      Sudarshan Datta i have the same problem.
      It shows NoClassDefFoundError: org/apache/commons/logging/LogFactory

    • @sudysona
      @sudysona 9 лет назад

      tejeswi vallamkonda Did u include logging classes as shown by Java brains during library setup? If so, ensure that the libarary is part of your current classpath.

    • @aleksejskadulins6064
      @aleksejskadulins6064 9 лет назад

      Sudarshan Datta Thanks you, I had the same problem, you helped me a lot. This logging class is commons-logging-x.x.jar

  • @PratikShende91
    @PratikShende91 9 лет назад

    java.io.FileNotFoundException: class path resource [spring.xml] cannot be opened because it does not exist ,sir am getting this error..help me in that

    • @Java.Brains
      @Java.Brains  9 лет назад +1

      Pratik Shende Should be obvious if you read the error! :) It doesn't find the spring.xml file. Check the path, and make sure it matches what I do in the video.

    • @PratikShende91
      @PratikShende91 9 лет назад

      Ohh.thanks for the rply sir.I resolved that problem.actually problem.was in XML doc tag..as m using spring 4.1.6 .so the XML pattern is different for that.now its working sir.your teaching is good sir.Thanks for uploading videos.

    • @programm.r
      @programm.r 9 лет назад

      Pratik Shende Hi, would you mind providing a quick explanation and the code of the changes made using the latest version?

    • @PratikShende91
      @PratikShende91 9 лет назад

      Robyn Silber yeah.why not?just search for the XML pattern releated to the version you are using then just copy the XML pattern into your .XML file.it will work.if you still won't get how to do that,send me your mail id..ill gonna send you the XML pattern.

    • @SimpleGita
      @SimpleGita 9 лет назад

      Pratik Shende Could you post it here ?

  • @ayanmukherjee333
    @ayanmukherjee333 6 лет назад

    If you are getting XmlBeanFactory is deprecated warning use this alternative code
    ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
    BeanFactory factory = context;

    • @dev-skills
      @dev-skills 5 лет назад

      Or you can use a
      Triangle triangle = (Triangle) context.getBean("triangle"); // instead of factory.getBean("triangle")

  • @YasirShabbirChoudhary
    @YasirShabbirChoudhary 9 лет назад

    nice tutorial Sir G

  • @michaeltansy
    @michaeltansy 9 лет назад

    I dont have that spring folder in my java project, how you guys have that? fyi spring is already installed on my computer

  • @rexsam3134
    @rexsam3134 2 года назад

    How important is this 10 year old video if it is deprecated?

  • @luckyshaqqq
    @luckyshaqqq 10 лет назад

    hey, does anyone know the difference between the id and the name of the bean?

  • @jiatong950
    @jiatong950 8 лет назад

    很好

  • @HH_Linkmusic
    @HH_Linkmusic 4 года назад

    try this ClassPathXmlApplicationContext mContext=new ClassPathXmlApplicationContext("spring.xml")

  • @simplyabdou8425
    @simplyabdou8425 2 года назад

    those poor keyboard keys really took a beating :(

  • @gdthumar377
    @gdthumar377 5 лет назад

    Can you give link for jars!

  • @sachdevtipu
    @sachdevtipu 11 лет назад

    get a warning that the XMLBeanFactory has been deprecated

    • @chetanyachopra6716
      @chetanyachopra6716 5 лет назад

      use ApplicationContext to get beans like this
      ApplicationContext context = new ClassPathXmlApplicationContext('yourPathOfConfigFlie');
      context.getbean("beanID");

  • @himanshudgp
    @himanshudgp 8 лет назад

    people who are facing problems while using XmlBeanFactory can start using ClassPathXmlApplicationContext to initialize *bean.xml. I hope this will solve the problem also for more discussion go through : stackoverflow.com/questions/5231371/springs-xmlbeanfactory-is-deprecated#answer-9210939

    • @osirisrobledo8425
      @osirisrobledo8425 8 лет назад

      I'm getting a "java.io.FileNotFoundException exception" for my file "spring.xml"
      ApplicationContext context= new ClassPathXmlApplicationContext("triangle.xml");
      Triangle triangle = (Triangle) context.getBean("triangle");
      triangle.draw();