Ond*_*zek 31 null spring properties default-value
我想在Spring XML配置文件中定义默认属性值.我想要这个默认值null.
像这样的东西:
...
<ctx:property-placeholder location="file://${configuration.location}"
ignore-unresolvable="true" order="2"
properties-ref="defaultConfiguration"/>
<util:properties id="defaultConfiguration">
<prop key="email.username" >
<null />
</prop>
<prop key="email.password">
<null />
</prop>
</util:properties>
...
Run Code Online (Sandbox Code Playgroud)
这不起作用.甚至可以null在Spring XML配置中定义属性的默认值吗?
Ant*_*lov 85
最好以这种方式使用Spring EL
<property name="password" value="${email.password:#{null}}"/>
Run Code Online (Sandbox Code Playgroud)
它检查是否email.password指定并将其设置为null(不是"null"String)