-
Feature Request
-
Resolution: Unresolved
-
Major
-
None
-
None
When not using (C)DI, you can easily see when a component is created too early by looking at the stacktrace:
"database username is null"
at ConnectionManager.createConnection()
at DogDao.createInstance()
at DogDao.getInstance()
at PersonDao.createInstance()
at PersonDao.getInstance()
at PersonService.createInstance()
at PersonService.getInstance()
at Main.beforeDatabaseUsernameIsAsked()
Clearly, beforeDatabaseUsernameIsAsked() has the problem: it shouldn't call PersonService.getInstance().
However, turn this code into (C)DI and you get something like this stacktrace:
"database username is null"
at ConnectionManager.createConnection()
at java.reflect....
at org.jboss.weld...
at org.jboss.arquillian...
Now, it's not clear any more that Main.beforeDatabaseUsernameIsAsked() is the problem, isn't it?
There is absolutely no mention of Main.
And then it is a challenge to find out what's causing the lifecycle to behave differently that you expected
and how the lifecycle is actually behaving now.
It would be nice if the exception message contains something like
"database username is null" during creation of ConnectionManager for DogDao for PersonDao for PersonService for Main at ConnectionManager.createConnection() ....
- is related to
-
WELD-964 Unsatisfied dependency exception should differentiate between "class is not in classpath", "class is in classpath but not managed bean" and "class is in classpath and managed but not like that"
- Resolved