A: @Autowired is not necessary if you have one constructor that instantiates the fields
C: Constructor injection is preferred over field injection, as it helps with unit testing. Most IDE's will warn you against field injection anyways.
Contructor injection is preferred because it allows for easier unit testing. If only one constructor is available it will be used to inject dependencies without the need of @Autowired annotation.
As of Spring Framework 4.3, an @Autowired annotation on such a constructor is no longer necessary if the target bean only defines one constructor to begin with.
Answer A and C
upvoted 3 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Ancient1
Highly Voted 5 months, 3 weeks agoantpao86
Most Recent 3 months, 4 weeks agoEymet
4 months agozakupower
11 months agofaciorys
1 year, 1 month ago