Standard naming to the Spring beans Standard naming to the Spring beans spring spring

Standard naming to the Spring beans


Bean Naming Conventions (Spring Framework Reference section 1.3.1)

The convention is to use the standard Java convention for instance field names when naming beans. That is, bean names start with a lowercase letter, and are camel-cased from then on. Examples of such names would be (without quotes) 'accountManager', 'accountService', 'userDao', 'loginController', and so forth.

Naming beans consistently makes your configuration easier to read and understand, and if you are using Spring AOP it helps a lot when applying advice to a set of beans related by name.


camelCase seems right! For bean Id's, the naming convention would be same as Java class field name. The bean ID for an instance of ServiceDAO would be serviceDAO. The package name can be prefixed to the bean ID for larger projects.


Are you not using annotations? If you do then you don't need to follow any bean id naming convention.

If not (for whatever strange reasons) then camelCase is right. But the naming convention has to indicate which layer the bean belongs and ofcourse the name should correspond to the class its going to be injecting.

Hope that helps.