[
https://issues.jboss.org/browse/WELD-1032?page=com.atlassian.jira.plugin....
]
Ales Justin commented on WELD-1032:
-----------------------------------
Any suggestion on how to transparently fix this?
(by not have to change all exception handling code ...)
Lifecycle stacktrace in the exception message: What's causing is
my bean being to be created too early?
-------------------------------------------------------------------------------------------------------
Key: WELD-1032
URL:
https://issues.jboss.org/browse/WELD-1032
Project: Weld
Issue Type: Feature Request
Reporter: Geoffrey De Smet
When not using (C)DI, you can easily see when a component is created too early by looking
at the stacktrace:
{code}
"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()
{code}
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:
{code}
"database username is null"
at ConnectionManager.createConnection()
at java.reflect....
at org.jboss.weld...
at org.jboss.arquillian...
{code}
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
{code}
"database username is null"
during creation of ConnectionManager
for DogDao
for PersonDao
for PersonService
for Main
at ConnectionManager.createConnection()
....
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira