1.

What is the importance of @Required annotation?

Answer»

The annotation is used for indicating that the property of the bean should be populated via autowiring or any explicit value during the bean definition at the CONFIGURATION time. For example, consider a code snippet below where we NEED to have the values of age and the name:

import org.Springframework.beans.factory.annotation.Required;PUBLIC class USER { private INT age; private String name; @Required public void setAge(int age) { this.age = age; } public Integer getAge() { return this.age; } @Required public void setName(String name) { this.name = name; } public String getName() { return this.name; }}


Discussion

No Comment Found