teddy teddy
teddy teddy

Reputation: 3085

default value for PropertiesPlaceholderConfigurer in spring?

if I reference a variable in my bean definition, and provide it from PropertiesPlaceholderConfigurer, but don't provide it in any properties files, Spring fails saying it can't resolve the var.

is there any way to provide a default?

Upvotes: 0

Views: 169

Answers (1)

sourcedelica
sourcedelica

Reputation: 24040

Since Spring 3.0 you can provide a default in your placeholder.

For example, if you had a String property, this placeholder would have a default value of "default": ${propertyName:default}

Upvotes: 2

Related Questions