Springboot @cacheable mit @Bean -Nutzung
Posted: 11 Apr 2025, 11:58
Ich bin auf einen Code gestoßen, in dem @cacheable Annotation mit @Bean verwendet wird und die Klasse mit @Configuration < /p>
beispielsweise < /p>
kommentiert wurde@Configuration
public class CacheManager {
@Cacheable("urls")
@Bean
public Map loadUrl(){
// hashmap population logic
return urlMap;
}
}
< /code>
Laden Sie alle Caches in der Konfigurationsphase?
oder die @cacheable Annotation wird ignoriert. Das liegt daran>
beispielsweise < /p>
kommentiert wurde@Configuration
public class CacheManager {
@Cacheable("urls")
@Bean
public Map loadUrl(){
// hashmap population logic
return urlMap;
}
}
< /code>
Laden Sie alle Caches in der Konfigurationsphase?
oder die @cacheable Annotation wird ignoriert. Das liegt daran>