title: Can Spring @Cacheable be configured to block on a cache miss?
body: <p>Can the Spring <code>@Cacheable</code> be configure so that if there is a cache miss calls to the cacheable method get blocked until the cacheable method executes once and the cache is populated?</p>
  
  <p>In my case I am dealing with data from the db that does not change often in fact if this data changes then the app will need to be restarted. I can create <code>@PostConstruct</code> methods and init the data as each service is launching but that does not seem as "elegant" as the <code>@Cacheable</code> annotation. </p>
  
  <p>I am planning to use EhCache with the Spring <code>@Cacheable</code> annotation. </p>
  
  <p><strong>update:</strong></p>
  
  <p>Here are some issues that I ran into in trying to use @PostConstruct, in case some one else run into those issues. <code>@PostConstruct</code> methods can't be <code>@Transactional</code> because they run after the properties of the object are set and not after the whole spring context is configured. So you can't assume that the TX manager is all setup and configured by the time <code>@PostConstruct</code> method is called. The workaround for this is to implement a <code>ApplicationListener</code> and inject a TransactionTemplate manually ... etc a lot of extra work that is simplified by using <code>@Cacheable</code>.</p>