Beans

Use preferences in Spring

Spring provides PreferencesPlaceholderConfigurer that can be used to load preferences.

<bean id="preferencePlaceHolder"
	class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
	<property name="userTreePath" value="com.myapp.preference.staticPreferenceLoader" />
</bean>
<bean id="myEntity" class="info.dependencyInjection.spring.factory.MyEntity">
	<property name="value" value="${fruit}" />
</bean>

Related Article:

Reference: Use java.util.prefs.Preferences instead of java.util.Properties from our JCG partner Rahul Sharma at the “The road so far…” blog

Ilias Tsagklis

Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Back to top button