-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constructor eyes only cdi and formatting of injections docs #742
Changes from all commits
f188eea
5fb21cb
a15a45b
e3c37b9
76b7a9e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,18 +47,18 @@ | |
|
||
private final ClientDao dao; | ||
|
||
@Inject | ||
public ClientsController(ClientDao dao){ | ||
this.dao = dao; | ||
} | ||
|
||
/** | ||
* @deprecated CDI eyes only | ||
*/ | ||
public ClientsController(){ | ||
protected ClientsController(){ | ||
this(null); | ||
} | ||
|
||
@Inject | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you change the previous example to use constr injection too? https://github.com/vitornp/vraptor4/blob/docs/vraptor-site/content/en/docs/one-minute-guide.html#L19 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, nevermind. My bad, because the example explain how to inject via field. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previous example is used injection the attribute Description of this example: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
public ClientsController(ClientDao dao){ | ||
this.dao = dao; | ||
} | ||
|
||
// controller methods | ||
} | ||
~~~ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think should be
public
to CDI eyes. Whyprotected
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope.
protected
is better.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really. Sorry. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just need the default constructor, since it isn't private, is it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error:
WELD-001435: Normal scoped bean class ClientsController is not proxyable because it has no no-args constructor - <unknown javax.enterprise.inject.spi.Bean instance>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using injection in the constructor is needed the default constructor to CDI. Just can't be private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, get it wrong your question. That's it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @vitornp. I told just about the
private
default constructor, just in this case we get error.Anyway, thanks. 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍻