Re: IoC (DI) Newbe quetion
Quote:
Originally Posted by litterat
Please correct me if I am wrong but if I am trying to summerise the functionlity of IoC (DI specific), then it is some clever mechanisim to pass configuration data into my newly created objects.
If this it true what if I want to use some precreated objects to intialise my objects (What seems to me a much more general case then to create newly initialized object)
Most of my objects are created in Spring and I don`t have to retrieve them from somewhere else. But there are ways to pull beans outside of Spring into Spring. Check the FieldRetrievingFactoryBean for example.
What are you trying to do? What objects do you want to pull into Spring?
Re: IoC (DI) Newbe quetion
Quote:
What are you trying to do? What objects do you want to pull into Spring?
I will give a simple example.
Lets say I have a report object that print a message,
the message is created from user input
I see no way for Spring to help me in intaiting the message object nor the report object
The problem is that the dependenicies of an object usually are not decided in creation time but might allready exist in the system
Re: IoC (DI) Newbe quetion
Quote:
I will give a simple example.
Lets say I have a report object that print a message,
the message is created from user input
Anybody can outline to me the way you would do this in Spring
Re: IoC (DI) Newbe quetion
Quote:
Originally Posted by litterat
Quote:
What are you trying to do? What objects do you want to pull into Spring?
I will give a simple example.
Lets say I have a report object that print a message,
the message is created from user input
I see no way for Spring to help me in intaiting the message object nor the report object
Could you give a more detailed example? And remember: Spring is not responsible for creating all objects (else Spring would be a nightmare to use).
Quote:
The problem is that the dependenicies of an object usually are not decided in creation time but might allready exist in the system
Try to make this clear in your example.