Spring Provided beans
BeanPostProcessor InterfaceBeanFactoryPostProcessor Interface
BeanNameAware
BeanFactoryAware
ApplicationContextAware
These beans related to :Spring Bean Life Cycle
org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
Set properties from a properties file. Use placeholder ${} ref to property name
Set <bean> PropertyPlaceholderConfigurer, or use <context:property-placeholder>
Notice: only work in ApplicationContext. Does NOT work with BeanFactory
<!-- Use PropertyPlaceholderConfigurer as a bean --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>com/gvace/dispatch/db.properties</value> <value>com/gvace/dispatch/db1.properties</value> </list> </property> </bean> <!-- Or use <context:property-placeholder> <context:property-placeholder location="classpath:com/gvace/dispatch/db.properties, classpath:com/gvace/dispatch/db1.properties"/> --> <bean id="dbutil" class="com.gvace.dispatch.DBUtil" > <property name="drivername"><value>${drivername}</value></property> <property name="url" value="${url}"></property> <property name="username" value="${username}"></property> <property name="pwd" value="${pwd}"></property> </bean>
No comments:
Post a Comment