5
私はa.propertiesとb.properties 2つのプロパティファイルを持っているを使用して、私は、アプリケーションのコンテキストに追加しました:プロパティを持つ最初のファイルは、(DB接続の詳細が含まれてい@value注釈
<context:property-placeholder location="classpath:a.properties" />
<context:property-placeholder location="classpath:b.properties"/>
これは正常に動作します) 2番目の - 特定のBeanによって使用されるプロパティが含まれています。私は@Value
注釈
@Value("#{qw.er}")
private String someA;
@Value("#{as.df}")
private String someB;
を経由して、これらのプロパティを使用してそのBeanで は、しかし、私は、起動時に例外を取得:
org.springframework.expression.spel.SpelEvaluationException:
EL1008E:(pos 0): Field or property 'qw' cannot be found on object of type
'org.springframework.beans.factory.config.BeanExpressionContext'
私が間違ってやっていますか?
1つのファイルに2 context:property-placeholder
を使用できますか?
PS:プロパティqw.erとas.dfファイルb.propertiesにのみ存在
[this](http://stackoverflow.com/questions/317687/how-can-i-inject-a-property-value-into-a-spring-bean-which-was-configured-using )。あなたは '@Value("#{myProperties ['github.oauth.clientId']} ")' – GokcenG
を実際に使って、 '@Value('#{myProperties ['github.oauth .clientId ']} ")' – maks
申し訳ありません、私はあなたの質問を誤解しました。あなたは ' 'を使い、 '@Value("#{config ['as.df']} ")'が役に立ちます。私は '
GokcenG