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

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -