Reputation: 339
I have a bean (Iconstant) which has all the constant declared. I have declared the bean definition in beans.xml
file. I want to load the bean property values from database. Basically, some of the values would be assigned in the beans.xml
file itself and i want some to be loaded from database itself. for eg, output location of a file.
I searched the internet, and all i could found is through propertyplaceholder.
So, is there any way to load the bean property value through Database ??
Upvotes: 1
Views: 1081
Reputation: 47310
Sounds like it could also be a case for injecting a value from a property file create a file
myConstants.properties
it could have this in
web.title=stack
then in cotnext definition do this
<context:property-placeholder location="classpath:myConstants.properties"/>
And in your java you can do this
@Value("${web.title}")
private String myTitle;
Upvotes: 0
Reputation: 12942
you can use init-method
or @AfterConstruct
to initiate values of this bean and inject the DAO to this bean to be used to read data from database
Upvotes: 1