This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Create an instance of Abstract Class through Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Create an instance of Abstract Class through Spring" Watch "Create an instance of Abstract Class through Spring" New topic
Author

Create an instance of Abstract Class through Spring

Gaurav Ram
Ranch Hand

Joined: Feb 23, 2008
Posts: 32
Hi,

As per the java rule we cannot Instantiated Abstract class, thats 100% right.

But my confusion arise when i saw the strange behavior in Spring, that, i have created one Abstract class and in that i have created on lookup method and thats also abstract.Then in my Spring config file i have written the below code:


and i run my container and this bean initialized successfully, but when i remove the code <lookup-method name="getLatestObjectOfBean" bean="beanToGetFromLookupMethod"/> from above bean defination then it starts giving error which is right that it should not create an instance of Abstract Bean.

Can you please explain the reason for this.?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

The lookup method injection is described here. Do you still have any doubt after reading it ?


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create an instance of Abstract Class through Spring