Spring 3.1.1を使用していくつかのフィールドにプロパティ値を入力したいのですが、フィールドは常にnullのままです。
applicationContext.xmlに追加されました
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<util:properties id="props" location="classpath:application.properties" />
application.properties:
myProp=value
javaクラス:
@Value("#{props[myProp]}")
private String myField;
ただし、Beanの作成時に、myFieldはプロパティファイルの「値」で埋められませんが、nullのままです。
また試してみました(成功しませんでした):
@Value("#{props.myProp}")
private String myField;
と
@Value("#{myProp}")
private String myField;
移動した後に「ファイルが見つかりません」というメッセージが表示されたため、application.propertiesファイルが見つかりました。
ここにスタックトレースがあります:http://pastebin.com/5A8i5gF8
何を変更する必要がありますか?