0
構成:春コンテキストの春のキャッシュは動作しません(SimpleCacheManager)
@Configuration
@EnableCaching
@ComponentScan("by.bsu.chemistry")
public class AppConfig {
@Bean
public CacheManager cacheManager() {
SimpleCacheManager manager = new SimpleCacheManager();
manager.setCaches(Collections.singleton(new ConcurrentMapCache("panes")));
return manager;
}
}
初期化:
public class Main extends Application {
public static BorderPane borderPane;
ConfigurableApplicationContext context;
@Override
public void init() throws Exception {
super.init();
context = new AnnotationConfigApplicationContext(AppConfig.class);
}
とキャッシュの使用量がBoxUtilsクラスである:
@Component
public class BoxUtils {
//some code
@Cacheable(value = {"panes"})
public Pane getDefaultPane(String title){
VBox vBox = new VBox();
//some code
System.out.println("getDefaultPane(" + title + ") = " + vBox);
return vBox;
}
たびに方法getDefaultPane(String title)
が呼び出されると、コンソールのプログラム出力 "getDefaultPane(......) = [email protected]
結果をキャッシングするのではなく、毎回メソッドが機能します。 私は何が間違っていますか?
*実行前のスタックトレースgetDefaultPane
キャッシュプロキシは呼び出されません!チェック@Cacheable
ログインのTRACEレベル(org.springframework.cache)
DEBUG AnnotationCacheOperationSource [AbstractFallbackCacheOperationSource.java:101] Adding cacheable method 'getDefaultPane' with attribute: [Builder[public javafx.scene.layout.Pane by.bsu.chemistry.util.BoxUtils.getDefaultPane(java.lang.String)] caches=[panes] | key='' | keyGenerator='' | cacheManager='' | cacheResolver='' | condition='' | unless='' | sync='false']