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