Announcement Announcement Module
Collapse
No announcement yet.
Spring bean definition null value Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring bean definition null value

    Code:
    public class A{
      private B b;
    }
    
    public class B{
    }
    Code:
    <bean id="aBean" class="A">
    <property name="b">  ???  </property>
    </bean>
    When use new A() to create A, b is null.
    How to create an instance of A with b = null when using context.getBean("aBean")?

    In the bean definition, I have tried <property name="b"><null/></property>, but this don't work.
Working...
X