Designing architecture based on plugins on top of Spring

I scratched my head around developing a simple plug-in architecture on top of Spring for one of my current applications. No matter how much separation you could achieve with patterns like MVC, you can always reach the point where communication is inevitable.

So I began to weigh the options. At first I thought the filters were good. Each plugin I would make would be a filter, which I then simply insert into the filter map. Of course, this will lead to a small malfunction when listing and checking all filters, but at least the controllers will not have to worry about what happened to the data before it is reached, or what happens afterwards, they just take care that pick up models (via DAO or something else) and return them.

The problem is that not all of my application requests are based on HTTP. Some of them are based on electronic messages, others on a schedule (by time), so filters will not help much if I do not try to adapt each type of incoming request to HTTPRequest, which would be too much.

Another one I was thinking about was annotation-based AOP, where I comment on each method, where the plugin will intercept methods based on certain conventions. My problem is that firstly, I am not so experienced in AOP in general, and secondly, just writing all these agreements already offers a bit of a combination

Most likely, the option, which mainly concerns my thinking, uses events based on Spring. Each type of request handler in my application (web controller, email handler, etc.) will be a kind of event dispatcher that will send Spring events to each main action. On the other hand, plugins will just listen when a specific event happens and do some logic. This will also allow me to use point # 1, as some of these plugins can also be filters, i.e. When they receive a notification that a specific controller action has been taken, they can simply decide not to do anything and rather wait until they are called by the filter chain. I see this as a somewhat enjoyable approach. Of course, overhead again arises here, as well as the factthat every class involved will be eb combined with Spring forever, but I see this as a necessary evil.

Spring - , , .

, . Spring , , ? , - , , - .

.

+5
1

Spring bean factory. , beans, , . .

"Event Driven Architecture". , , , , ( ), ( ) ( ). - , . JMS, node Spring, Mule, .

, , , , . , , , .

+1

All Articles