Skip to content

Commit

Permalink
Merge pull request #64 from Whale-lyi/init-and-destroy-method
Browse files Browse the repository at this point in the history
初始化方法增加判断是否与InitializingBean方法同名
  • Loading branch information
DerekYRC committed Nov 30, 2023
2 parents fe144dc + 727abca commit bb71305
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ protected void invokeInitMethods(String beanName, Object bean, BeanDefinition be
((InitializingBean) bean).afterPropertiesSet();
}
String initMethodName = beanDefinition.getInitMethodName();
if (StrUtil.isNotEmpty(initMethodName)) {
if (StrUtil.isNotEmpty(initMethodName) && !(bean instanceof InitializingBean && "afterPropertiesSet".equals(initMethodName))) {
Method initMethod = ClassUtil.getPublicMethod(beanDefinition.getBeanClass(), initMethodName);
if (initMethod == null) {
throw new BeansException("Could not find an init method named '" + initMethodName + "' on bean with name '" + beanName + "'");
Expand Down

0 comments on commit bb71305

Please sign in to comment.