Plexus

Most of you might be familiar with Spring but not Plexus. Plexus provides an Inversion of Control (IoC) or a Dependency Injection (DI) framework similar to Spring. If you are new to the concept of Dependency Injection, it's highly recommended that you go through the article by Martin Fowler, Inversion of Control Containers and the Dependency Injection pattern at http://martinfowler.com/articles/injection.html.

Forget about Maven for a bit; let's see how to implement Dependency Injection with Plexus with the following steps:

  1. First, we need to define our own Java interface for our business service as follows. There can be more than one implementation of this service:
    package com.packt.di; public interface MessagingService { public void sendMessage(String ...

Get Mastering Apache Maven 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.