wood burning stoves
The moose likes Spring and the fly likes Dynamic bean creation in Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Dynamic bean creation in Spring" Watch "Dynamic bean creation in Spring" New topic

Dynamic bean creation in Spring

saakshi jain

Joined: Sep 26, 2011
Posts: 10
Hi ,

Is there a way in spring wherein we can read the fields of a bean from the DB table and create a complete bean class - with getters and setters on server startup???

I require this to make my application completely configurable...as in if I have to add a new field in future , all I would require would be adding a field in the db and the bean setters and getters would be available to me.

Vijitha Kumara

Joined: Mar 24, 2008
Posts: 3899

Better sit in the Spring forum. Moving...

[How to ask questions] [Twitter]
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 607

Nothing in Spring that I know off provides this functionality off the shelf.
Creating a class dynamically at run time ... I pretty sure that's been tried a few times. Reflection could work - but it won't be pretty

google - creating a class dynamically in java

and this post on the Ranch - http://www.coderanch.com/t/385084/java/java/creating-simple-java-objects-dynamically

Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
I agree. Here's the link: http://aspose.com/file-tools
subject: Dynamic bean creation in Spring
jQuery in Action, 3rd edition