Explain the concept of inner beans in Spring?
Answered
Explain the concept of inner beans in Spring?
Best answer
Spring inner beans are beans that are defined within the scope of another bean. The concept is very similar to Java inner classes. Inner beans are supported both by constructor injection as well as setter injection.
Inner beans are typically used when a bean is being referenced by only one bean. An important point to note is that scope, id and name tags for inner beans are always ignored by the Spring container. Inner beans are always anonymous and they are always scoped as prototype.