上のファイル:だから、私のように値にアクセスしてい更新値は、私は以下のような構成をしたランタイム
cache.time.milliseconds=1000
:
@Configuration
public class PropertyConfiguration {
@Bean
@Profile("local")
public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
configurer.setLocation(new FileSystemResource("path/to/resources/app-local.properties"));
configurer.setIgnoreUnresolvablePlaceholders(true);
return configurer;
}
}
私app-local.properties
ファイルには、などの値が含まれています
@Value("${cache.time.milliseconds}")
private long cachingTime;
私は正しい値を得ています。今
System.out.println(cachingTime);
、私はいくつかの他の値にcachingTime
を更新し、その更新された値を提供したいです。たとえば、1000から99です。
実行時にこのプロパティ値を更新する方法はありますか?
また、アプリケーションやサーバーの再起動を除いてこの値を更新する方法はありますか?
私はSpring Boot 1.4.3.RELEASEを使用しています。
私はGoogleにそれを試みましたが、答えのどれも私に解決策を与えませんでした。 :(
は、任意の助けてくれてありがとう。
私はそれを知っている...しかし、私の要件は、私は、サーバーやアプリケーションを再起動すべきではないです。 :) –
他に選択肢はありません –