Spring bean with no id or name

I'm reviewing some Spring code, and I see a few bean defs that do not have an id or a name. The person who did it is not around to ask. The application is working fine. I am not familiar what this necessarily means. Anybody know if this means anything in particular?

Answers


Some beans are not required to be accessed by other beans in the context file or programmatically. So as mentioned by JacobM, they don't require an id or name as they're not referenced.

Such an example would be a PropertyPlaceholderConfigurer, which reads a property file, then allows for runtime property replacement in the context definition.

The example definition would be

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  <property name="location" value="myapp.properties" />
</bean>

The JavaDoc provides further documentation on this object, but further on in the file you can reference properties from your file by just using the standard template replace placeholder ${...}.


Need Your Help

Block specific links in redirected page in c#

c# .net url browser webbrowser-control

I am creating an test where I provide certain help links to the candidate along with the question. Now I the user must be able to browse through the redirected site but cannot go to any external si...

Flex shader effects: render one object into another

flex actionscript-3 shader blur pixel-bender

I want to make such effect: draggable semi-transparent object (let's call it 'plastic strip') over window with arbitrary objects. Plastic strip should be turbid, i.e. it blurs content under it (not

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.