Announcement Announcement Module
Collapse
No announcement yet.
Spring beans are initialized by container but not autowired Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring beans are initialized by container but not autowired

    Hi,
    I am migrating one web appliation from WAS to WLS. There are three beans defined in applicationContext.xml

    Evn: Win2008R2 64bit, Oracle Weblogic Server 12.1.1.0.1.201203120349-12.1.1-win32, JRockit R28.2.7


    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...-beans-2.5.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schem...ng-aop-2.5.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schem...ing-tx-2.5.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-2.5.xsd">

    <context:annotation-config/>
    <bean id="domain" class="xxx.DALP8Domain" >
    <property name="configFile">
    <value>cmis.properties</value>
    </property>
    </bean>
    <bean id="exceptionHandler" class="xxx.DALP8ExceptionHandler"/>
    <bean id="cmisConfig" class="xxxx.CMISConfig" >
    <constructor-arg>
    <value>cmis.properties</value>
    </constructor-arg>
    </bean>
    </beans>

    Also I have bootstrap singleton class CMISBootstrap.java has the following code for autowired
    public class CMISBootstrap extends SpringBeanAutowiringSupport {
    @Autowired
    private CMISDomain domain;
    @Autowired
    private CMISExceptionHandler exceptionHandler;
    @Autowired
    private CMISConfig cmisConfig;

    //return the singleton instance
    public static synchronized CMISBootstrap getSingletonObject() {
    if (ref == null) {
    ref = new CMISBootstrap();
    ref.init();// do something for autowired beans
    }
    return ref;
    }
    .....
    }
    Note:
    DALP8Domain is the implementation of CMISDomain, has the setter method for bean
    DALP8ExceptionHandler is the implementation of CMISExceptionHandler, has the setter method for bean
    CMISConfig is the concerete class. has the setter method for bean

    it works fine on Websphere Application Server 7 with Spring 2.5.6. But on WLS 12.c, I noticed that the beans are initialized by container successfully, but three beans are not autowired in this instance. The application has the same spring jars and <wlsrefer-web-inf-classes>false</wlsrefer-web-inf-classes>
Working...
X