java - Recommended usage of Spring's @Required annotation -
I think a @ mandatory annotation to mark the member variable in the beans in the spring , Which should be set.
Is there any best practice to use this?
For example, setting these values to the constructor would be better and these parameters must be clearly needed (esp. When used outside the spring)?
Thank you! @ essential , annotations provides Martin Fowler, not directly referencing.
..
Set the object values in the constructor compared to the setters Because it " clearly gives you a clear statement of what it means to make a certain object in a clear place " while also " Clearly allow to hide that which are not just providing the setter ".
Comments
Post a Comment