xml裏的定義java
<bean id="xxxx" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="${datasource.fw.url}" />
<property name="username" value="${datasource.fw.username}" />
<property name="password" value="${datasource.fw.password}" />
</bean>spring
properties裏的定義sql
datasource.fw.url=xxxx
datasource.fw.username=xxxx
datasource.fw.password=xxxxdocker
可是報錯apache
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'fwConnectionPool' defined in class path resource [applicationContext-datasource-dbcp2.xml]: Could not resolve placeholder 'datasource.fw.url' in value \"${datasource.fw.url}\"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'datasource.fw.url' in value \"${datasource.fw.url}\"\n","stream":"stdout","time":"2019-12-24T03:32:56.761664764Z"}
app
本地能夠執行,可是打成docker的image就沒法啓動。很迷post
這個問題兩天後解決了,是jenkins的pipeline裏定義的配置不對url