• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

referencing multiple objects from a Object.. How to set up reference in the beans.xml file

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Newbie here. Spending my first hour on the spring framework.
I was trying to add some references to some dependent classes to see how the framework works.
In my hello world object i would like to create a refernce to a car object and a engine object and a wheel object etc.. car engine and wheel objects are all contained in the hello world object.
Please feel to ask any information i may have left out.
appreciate any inputs.
Ram



<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<bean id="helloWorld" class="com.tutorialspoint.HelloWorld">
<property name="message" value="Hi there!"/>

<bean id="helloWorld" class="com.tutorialspoint.HelloWorld">
<property name="message" ref=”CarObj”/>

<bean id="CarObj" class="com.tutorialspoint.Car">
<ref id="wheel" class="com.tutorialspoint.Wheel">


</bean>



</beans>
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
first. because you put beans.xml makes me think you are not using up to date materials. It has been years and years since people used that file name.

2) a bean tag can have as many constructor-arg and property tags as needed between the opening and closing of the bean tag

Example



Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic