|
From: Matt S. <sga...@us...> - 2004-12-18 16:53:08
|
Hi Spring developers,
For an application I am working on, it would be nice to make the
exception handling behavior of the ApplicationContext more similar to
the DataBinder. That is, when the application context is starting up,
it would be nice to have a whole list of errors come up rather than only
one error at a time. So, assuming the XML file has a valid format,
figure out *each* bean that is invalid and display *all* of those beans
instead of doing it one-at-a-time.
How would you suggest I go about implementing such functionality, and
would the Spring team be interested in including this functionality in
the Spring core? I can certainly write it and implement it.
My use case is this:
- We allow users to define multiple databases, one of which is chosen
when the user logs in (kind of like BugZilla or Rational's ClearQuest).
We are building a GUI that allows users to graphically add databases
which our app internally stores in a Spring application context. We
would like to aggregate all the problems with the databases in the
application context at once. This would be useful to detect, for
example, if the network was down vs. just a single database is down.
I was thinking perhaps a new interface would be beneficial. Maybe
DebuggableApplicationContext extends ConfigurableApplicationContext {
/** Returns a Map of bean names to exceptions that lists the problems
that would be encountered if the application context were to have its
refresh() method called */
Map testBeanDefinitions();
}
What ideas do you guys have? Below is Rod Johnson's initial response
from the user forums. Thanks! - Matt
Interesting idea. Probably best to discuss on the Spring Developer
mailing list.
There are certainly some technical challenges here, as one failure may
make it impossible to even attempt to initialize other beans. But it may
be possible to continue in some circumstances.
Rgds
Rod
|