Announcement Announcement Module
No announcement yet.
Singleton=false no longer supported? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Singleton=false no longer supported?

    We have a spring-based application that we're migrating from an old version of spring (2.0.6) to spring 4.0.3. All of our config files use the old style XML header as you'll see in my example.

    I'm seeing that the singleton attribute seems to be ignored on bean definitions defined in this way. For example, if I create an ApplicationContext with the following XML and do a getBean("nsBean") twice, I get the same instance. Is this no longer supported? I've tested converting the XML and using scope="prototype" and that works, but was hoping to avoid all those changes.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "">
    <beans default-lazy-init="true">
    <bean id="nsBean" class="java.lang.String" singleton="false"/>

  • #2
    I believe this is now the "scope" attribute.
    That kind of information is usually found in the migration guides.