Reputation: 2216
How do I create an instance of a static nested class as a Spring bean in an XML configuration file? For example:
package com.x.y;
public class A {
public static class B {
...
}
}
So that I have a Spring-managed bean of class B
?
Upvotes: 6
Views: 7999
Reputation: 403501
Using A$B
syntax, which is how the classloader sees inner classes. So assuming package com.x.y
, then:
<bean id="myBean" class="com.x.y.A$B"/>
Upvotes: 12