Spring's BeanNameAware - No Fluff Just Stuff

Spring's BeanNameAware

Posted by: Craig Walls on May 27, 2004

While perusing the Spring docs, I find the BeanNameAware interface. I've seen it before...in passing. But now I'm wondering: What practical use is there for this interface?

To avoid confusion, I'm not talking about BeanFactoryAware or ApplicationContextAware. These two interfaces make much more sense to me. It's the practical uses of BeanNameAware that eludes me.

I've looked at how Spring uses it internally with things such as the timing stuff. And that makes sense to me. But what else? I'm at a loss for any reason that any of my own beans would ever need to know their own name as registered in the beans XML file.

Craig Walls

About Craig Walls

Craig Walls is a Principal Engineer, Java Champion, Alexa Champion, and the author of Spring AI in Action, Spring in Action, and Build Talking Apps. He's a zealous promoter of the Spring Framework, speaking frequently at local user groups and conferences and writing about Spring. When he's not slinging code, Craig is planning his next trip to Disney World or Disneyland and spending as much time as he can with his wife, two daughters, 1 bird and 2 dogs.

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »