Wednesday 3 February 2021

Using CDI to extend functionality

I recently wanted to change the behaviour of the framework.

Now, usually this means having to change code in the framework, but as this is something I'd rather not do, I found a way around this.

The framework, just as the code I write, uses CDI.

So it was a simple case of telling CDI to inject my Bean, instead of the Framework Bean.

And it worked right out of the box.

I was pretty surprised.

References

Contexts & Dependency Injection for Java
http://cdi-spec.org/

No comments:

Post a Comment