Guard for null BeanFactory in @ConditionalOnBean

See gh-2080
Merge branch '1.1.x'