Frameworks like Spring and CDI use it internally. You ask for a bean to be injected, and the framework will locate an appropriate instance and inject that. JNDI look-ups can probably also be seen as the bean locator pattern.
"Bean Locator" is an implementation specific term. Patterns are supposed to be abstract, and what I suspect that what you are looking for is the Service Locator pattern.
Service Locators are resources that code can use to locate a particular set of functions, which are typically defined in terms of an Interface, although you can have a Service Locator return a concrete object as well.
I'll have to contest Rob's claim that resource frameworks such as Spring and CDI use Bean Locators internally. Those frameworks actually implement the Factory pattern and how they work internally is supposed to be opaque to their clients. In fact, it's common for them to keep their beans in an internal Map object (or chain of Maps), but that's purely their decision.
The lines are not clear-cut. A Service Locator is expected to return an existing interface/object, but there's no reason it cannot also manufacture one. I would, however expect a Service Locator to consistently return the same object, whereas a Factory has the option to return multiple instances of an object.
User-designed Factories generally return objects of only one or a small number of class/interface types. Systems like Spring are usually designed to return objects of many different types.
You could use a Service Locator to find a Factory, but in actual practice, the factory is typically a Singleton and located as a static class.
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
Create Edit Print & Convert PDF Using Free API with Java