java - How to load properties file from property file and database at the same time in Spring? -
i have app.properties file,which define database connection configuration such as
#datasource jdbc.driver=com.mysql.jdbc.driver jdbc.url=jdbc\:mysql\://localhost/test?useunicode\=true&characterencoding\=utf-8 jdbc.username= jdbc.password=
and place dynamic properties in database,load custom implementation of abstractfactorybean
,follow q&a https://stackoverflow.com/a/4601913
and applicationcontext.xml
<context:property-placeholder location="classpath:app.properties" order="1" /> <context:property-placeholder properties-ref="props" order="2"/> <bean id="datasource" class="org.springframework.jdbc.datasource.simpledriverdatasource"> <property name="driverclass" value="${jdbc.driver}" /> .... </bean>
cannot find class [${jdbc.driver}]
.
how can make sure abstractfactorybean
load properties first ?
Comments
Post a Comment