いろいろ備忘録日記

主に .NET とか Go とか Flutter とか Python絡みのメモを公開しています。

定数(static final)フィールドの値の設定方法

Springframeworkでどこかのクラスに定義されている定数(static final)値を設定するには
以下のように定義するようです。

    <bean id="printer" class="gsf.samples.springframework.sample001.ConsolePrinter">
        <property name="message">
            <bean id="gsf.samples.springframework.sample001.Printable.DEFAULT_MESSAGE"
                class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"/>
        </property>
    </bean>

・・・・・・・面倒くさいですね。

http://www.springframework.org/docs/reference/beans.html

3.16. Setting a bean property or constructor arg from a field value
に記述があります。(どうやってやるのかわからず結構探しましたw)