私のコントローラーは
@Value("${myProp}")
private String myProp;
@Bean
public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
return new PropertySourcesPlaceholderConfigurer();
}
@RequestMapping(value = "myProp", method = RequestMethod.GET)
public @ResponseBody String getMyProp(){
return "The prop is:" + myProp;
}
私のapplicationcontext.xml
持っている
<bean id="appConfigProperties" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
<property name="location" value="classpath:MyApps-local.properties" />
</bean>
次の例外が発生します。
原因: java.lang.IllegalArgumentException: 文字列値 "${myProp}" のプレースホルダー 'myProp' を解決できませんでした
注:私のプロパティファイルMyApps-local.properties
はにありclasspath
、含まれています
myProp=delightful
どんな助けでも素晴らしいでしょう....