Announcement Announcement Module
No announcement yet.
Application Context Method Call Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Application Context Method Call

    I have a small existing code-base whose main driver-class does a lot of instantiation and hook-up, which sounds exactly what Direct Injection is meant to help with.

    I am having trouble figuring out how to configure the applicationContext.xml to call a method of one of my objects that I create, because it doesn't fit the pattern of a Java Bean. The method is called "register" and it is intended to be called numerous times for as many *things* as you need registered. I don't want to call it "setRegister" because the word "set" implies a one time setting.

    For more background on the actual code, I have a class that is effectively a hashmap called IdManagerLookup. Then I need to instantiate IdManager(s), and then add them. Here is the code before Spring:

    IdManagerLookup idManagerLookup = new IdManagerLookup();
    NumberIdManager numberIdManager = new NumberIdManager();
    EntityIdManager entityIdManager= new EntityIdManager ();

    Please help me understand the right way to configure this "registering" behavior within the Spring application context infrastructure. Preferably without altering any code, since isn't Spring supposed to refrain from imposing structure?

    Thanks in advance.