Results 1 to 2 of 2

Thread: Legacy Singleton with argument to getInstance

  1. #1

    Default Legacy Singleton with argument to getInstance

    Hi All,

    I have a legacy Singleton class that takes an argument in the getInstance method.

    Code:
    xxxxDAO.getInstance(Logger logger);
    is there a way using factory-method to get the Logger parameter into the getInstance method, does anyone know?

    Thanks in advance

  2. #2

    Default

    you can pass Logger parameter as constructor arg as shown below:

    Code:
    <bean id="xDAO" class="MyDAO" factory-method="getInstance"> 
     <constructor-arg type="Logger" ref="logger"/>  
    </bean>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •