As far as I know, it is not possible to disable factory-initialization during ApplicationContext
loading. The LocalSessionFactoryBean
is a FactoryBean
. Spring will call that object's getObject()
method during initialization of the context and that will force the schema to be updated.
Note that the Configuration
instance of the LocalSessionFactoryBean
is configured and used directly in the afterPropertiesSet()
method. You won't be able to intercept it either.
You'll need to create your own Configuration
instance (or parse the file yourself) before the ApplicationContext
is created. You can look at the source code of LocalSessionFactoryBean
to see how that is done.