Spring provides the FactoryBean
interface to allow non-trivial initialisation of beans. The framework provides many implementations of factory beans and -- when
Why do you not inject the Factory in your AppConfiguration?
@Configuration
public class AppConfig {
@Resource
private SqlSessionFactoryBean factory;
@Bean
public SqlSessionFactory sqlSessionFactory() throws Exception {
return factory.getObjectfactory();
}
}
But may I did not understand your question correct. Because it looks to me that you are trying something strange - go a step back and rethink what are you really need.