• +91 9723535972
  • info@interviewmaterial.com

Spring Interview Questions and Answers

Question - What do you understand by @Required annotation?

Answer -

@Required is applied to bean property setter methods. This annotation simply indicates that the affected bean property must be populated at the configuration time with the help of an explicit property value in a bean definition or with autowiring. If the affected bean property has not been populated, the container will throw BeanInitializationException.

For example:

  • public class Employee
  • {
  • private String name;
  • @Required
  • public void setName(String name)
  • {this.name=name; }
  • public string getName()
  • { return name; }
  • }

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners