• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
 
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic