BeanNameAware Interface to be implemented by beans that want to be aware of their bean name in a bean factory. If a bean in spring implements BeanNameAware then that bean has to implement a method that is setBeanName. And when that bean is loaded in spring container, the name is set to this method.
Here is an example to implement this interface and printing the name when it is loaded.
Student.java (Which implements BeanNameAware)