Sep 22nd, 2011, 10:14 AM
Creating lists across multiple configs
Quite new to spring struggling to do something which I imagine spring can help with.
I have a processing class / manager in one maven module. This manager has handlers to delegate functionality to, handlers have an interface with method onEvent(Event). These handlers are defined in other maven modules. For modules that get included in the build, all the spring config gets loaded into 1 application context.
This works great, but I am unable to register my handler beans with the manager? Is there a spring way to do this / better approach?
I can hard code this, i.e. handlers take in the manager in the constructor and register themselves, but this sounds convoluted and requires an additional interface to keep things neat / safe.
Ideally, I'd like to create list that everything can add to, and this just gets passed in. I've read about merging collections, but that seems to be for properties. And also util:list but I cant see a way of doing this.
Starting to get a little stuck, any help / nudge in the right directions would be great thanks,
Sep 23rd, 2011, 06:00 AM
Seeing this sort of merging not quite agreeing with the spring paradigm. Rather than manually do it the solution I have now is a Register bean that takes in a manager and a handler, the manager implement's a common register interface and the register bean can invoke this in its constructor.
Means I have to create a bunch of random register beans, but at least its a reusable consistent way.
Tags for this Thread