4

In my spring xml file I have a bean:

<bean id="config" class="com.example.BeanConfig">
        <property name="description" value="Long Description Here" />
</bean>

Instead of defining the long string inline, I want to read the string from description.txt. Is there any way to do this in the xml without writing a Java class to handle it?

I already came across How do I load a resource and use its contents as a string in Spring but I am unclear how to get the bean contents into a property value.

Community
  • 1
  • 1
Phillip Godzin
  • 660
  • 1
  • 9
  • 21

1 Answers1

-1

You can use Spring's property placeholder and ${property_name} see https://dzone.com/articles/properties-spring

S.Watson
  • 59
  • 3