Given that you are instantiating the factory bean yourself, you are responsible for initializing it by calling afterPropertiesSet()
, which is where the connection is made.
If you register a BeanDefinition
instead, the context will take care of initializing it for you.