If set parent bean factory to self, once try to get an undefined bean, bellow condition if (parentBeanFactory != null && !containsBeanDefinition(beanName)) { ... } will always be true and StackOverflowError will be thrown. Sometimes, this issue is hard to detect during runtime, if self-reference is not allowed here, error will be found at the early time of startup. Also, a self-reference parent bean factory is valueless.

Comment From: pivotal-issuemaster

@liuhy365 Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-issuemaster

@liuhy365 Thank you for signing the Contributor License Agreement!