title: Hibernate+Spring - configure session before use
body: <p>I have a Spring Boot application with JPA/Hibernate. I would like to have an extra operation executed each and every time the session is created - namely <code>Session.setCacheMode</code>.</p>
  
  <p>I do not want to do it on all public entry points to my app, so a new annotation with AOP interceptor doesn't seem like a good idea. Just do it once for the entire application and forget.</p>
  
  <p>With this stack, how can I get access to the <code>Session</code> and do something with it before it's handed to the application? Does Spring or Hibernate expose a hook where I could add my callback/interceptor/listener?</p>