What is "Aware" ? When should I include in my Class name?

The interfaces you cite seem to be a Spring-specific convention for allowing objects to interact with the dependency injection container that created them. By implementing the interface, a class signals that it wants certain information from the container and at the same time provides a method through which to pass that information.

I'd see it simply as an attempt to find a generic name for an interface that offers such functionality, not necessarily a strong convention with a specific technical meaning.


Appending adjectives like "aware" to the end is a naming scheme often used for Java interfaces. This can then be implemented by classes, and the resulting is code which is more fluent to read for human beings, like

class Broker implements ApplicationContextAware { /* ... */ }

where it's quite easy to see that this class is a broker for something, and it knows how to deal with application contexts. Besides that, the "Aware" suffix has no special meaning from the Java (compiler) perspective.


Those are not classes, are interfaces. The name is just a convention on Spring meaning that some special framework object is going to be injected to that class if it is managed by the framework.

Directly from the docs of ApplicationContextAware:

Interface to be implemented by any object that wishes to be notified of the ApplicationContext that it runs in.

In this case, the bean that implements this interface will get a reference to the ApplicationContext managing the application.