Skip to content

Conversation

@antonigaudi
Copy link

Add throwing BeanDefinitionStoreException in loadBeanDefinitions method if ClassNotFoundException is occurred and number of beans registered by scanner is 0.
Issue: SPR-10900

when ClassNotFoundException is occurred and number of beans registered by scanner is 0.
@antonigaudi
Copy link
Author

I have signed and agree to the terms of the SpringSource Individual Contributor License Agreement.

@snicoll
Copy link
Member

snicoll commented Oct 21, 2014

Well, that's going to break existing apps, isn't it? Can you share a bit more context?

@antonigaudi
Copy link
Author

Let's think about the case of setting wrong config class name.

[before change]

  1. A user set wrong config class name and call AnnotationConfigWebApplicationContext.refresh().
    : No Exception is occurred.
    & Just INFO log : "No annotated classes found for specified class/package..."
  2. A user try to get bean defined in right config class
    : NoSuchBeanDefinitionException is occurred.

[after change]

  1. A user set wrong config class name and call AnnotationConfigWebApplicationContext.refresh().
    : BeanDefinitionStoreException is occurred.
  2. A user cannot try to get bean.

I think that if config class location is wrong, it would be better to inform it in application loading time than in getting bean time.

thanks.

@antonigaudi
Copy link
Author

I close this pull request because of Juergen Hoeller's explanation.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants