Announcement Announcement Module
Collapse
No announcement yet.
Problems when creating my service class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems when creating my service class

    Hi,
    I have a problem when I creates my service class MyServiceImpl.
    This class have a constructor that calls a method populateMap().
    This method populates a HashMap() that is defined as a private member in this service.
    I want to populate this HashMap on startup so I always have access this this objects and dont nead to create them on the fly... My problem is that populateMap() uses a couple of dao classes that is mapped in my applicationContext.xml... and when I try to use them they are still not set. This gives me a nullpointer exception..... does anybody have a solution to this?

    Thanks,
    Jake

  • #2
    You can't use init-method?

    Code:
        <bean id="myService" class="MyServiceImpl" init-method="populateMap">
            <property name="serviceA" ref="serviceA"/>
            <property name="serviceB" ref="serviceB"/>
        </bean>

    Comment


    • #3
      Originally posted by david_syer
      You can't use init-method?
      Thank you david for the fast answer, this works!
      //Jake

      Comment

      Working...
      X