• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Bean Scope - Trying to create a local bean inside another bean

 
Rancher
Posts: 1090
14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm not sure if this question has been asked before. I just couldn't find it.
I've just started learning Spring framework and I'm currently studying dependency injection and bean scope.

I have been able to create beans that can be referenced globally and the ones that we define inside a property tag or a constructor-arg tag.
But I haven't been able to create a bean that can be referenced by all the constructor-arg/all the property tags but that also can not be referenced
outside the bean in which these constructor args or property tags are defined.

Here is my faulty spring.xml. My application gets the triangle bean from the Spring container. The Triangle class has four fields- String type, Point point1, Point point2, Point point3,
and a parameterized constructor that takes all these four fields.
Point class has two fields, int xCord, int yCord and only getters and setters.



When I run my application, I get an org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException. Here is the trace.



At this point, I am not sure if Spring even provides for such an access. But I'm guessing there must be something Spring has to address the above requirement and I just haven't come across it.
Kindly help.

Chan.
 
Chan Ag
Rancher
Posts: 1090
14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, here are my class files.







Chan.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic