Announcement Announcement Module
No announcement yet.
Managing tree-like hierarchical data with Spring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Managing tree-like hierarchical data with Spring

    Confession: I'm a Spring noob. Have read thru reference docs, and really like the whole thing. Am considering refactoring our POJOs for Spring, but cant figure out the best approach.

    Background story: it's a webapp geared strictly towards remoting/messaging (no UI of any kind). Running on top of BlazeDS, and I establish new instance of 'client' POJO whenever a new client authenticates. The client object instance in turn instantiates multiple instances of data handling objects that in turn access DB, do their thing, and sends updates back. Basically I have a tree-like structure with BlazeDS adapter instance at the top, and two or more branched levels below.

    Question: can Spring manage such a structure? I dont see a problem with top-side adapter object (singleton), but all other objects are effectively multitons, and Spring does not provide explicit support for that. I see I can do method injection and obtain new bean for every child bean I need to instantiate, but there needs to be two-way communication between these beans so I need to inject parent bean instance into the child, and I just dont see how can this work for scope=prototype. Yes, I can inject the parent bean into the child manually but that kinda beats the purpose of using Spring.

    Possible solutions that I have considered:
    1. Establish new IoC container for every second-level child bean which would then effectively become singleton in the scope of it's container. Downside is explicit dependence on Spring framework which is discouraged all the way through Spring docs.
    2. Use JMS and decouple my beans by communicating exclusively via messages. Right now JMS looks intimidating, and it looks like I could theoretically use Spring's own ApplicationListener interface but that is too coarse - there can be thousands of bean instances floating around, and they only really need to communicate vertically (either to parent or child, never laterally), and ApplicationListener does not seem to provide this kind of filtering. I dont want to be dispatching events for all beans, just the ones who have subscribed to a certain topic.

    JMS seems like the way to go, but even in this case my beans will need some specific configuration data from the parent bean (ie beans need to be aware of their exact location in the tree) and again I just dont see how Spring could manage dependency injection in such a scenario?

    Any advice appreciated!


  • #2
    Managing tree like hierarchical data with Spring

    Are you guys working on a proper fix for this? I would like to play the game with AA. I have the game purchased from Mamba games and Im hoping that you guys will issue a patch to fix this issue before I receive the game next week.