-
Notifications
You must be signed in to change notification settings - Fork 40.2k
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
Multiple Constructors marked with @Autowired not working #17455
Comments
The behaviour in question is part of Spring Framework and is, I believe, working as designed. When you used |
Okay @wilkinsona I changed my code. Still getting an error.
Why is it not working? Is the documentation wrong? New code changes reflect in the github repo |
@farazdurrani As @wilkinsona already mentioned, when you used |
@mbhave thanks, I will do that. |
Here I raised the issue. |
Autowired is required by default right? the documentation is not very well written. All of these will fail: The only instance where you can have multiple constructors annotated is if all of them are Look at this question in one exam (not official) : |
When multiple constructors are marked by
@Autowired
, it doesn't work. Although Spring documentation clearly says this:I get this error:
This is my code:
I have created a simple github repo to reproduce the issue.
OS: Ubuntu 18.04
JDK 8.
Spring Boot version 2.1.6
The text was updated successfully, but these errors were encountered: