cdi

Why you should consider using Apache DeltaSpike

We always hear about the Spring vs Java EE fight. Do we always have to use one of them? For sure, they give you a lot of facilities, but, do we need all of those features that they bring with them every time? Well, actually you don't need to choose one of them always. There are a lot of other alternatives that help you build your applications, so, why not take a look at few of them? I'm here to show an alternative called Apache DeltaSpike. Apache DeltaSpike is a…

Keep reading

Building microservices using Undertow, CDI and JAX-RS

Choosing the right tools to create microservices is not always that simple. First, there are a lot of microservices application types, so, you need to choose the right tool for the right job. Second, there are a lot of tools to help you build these applications. I’m going to show you another tool set to help you build your microservices applications: Undertow + CDI + JAX-RS, persisting in a MongoDB. This will probably meet all your needs when we talk about microservices. Actually, it is pretty simple: We just need to…

Keep reading

CDI, Polymorphism and The Factory Pattern

One of the most useful things about object oriented programming is polymorphism. In fact, it makes our software have different behaviors without the need to explicit it in the code. For instance, you are writing a code to make a credit card transaction. If it is a VISA transaction, you should execute one specific action, if it is a MASTERCARD transaction, you should execute another specific action, so, the first thing you think about doing is: public void pay(Transaction transaction) throws UnsupportedCardNetworkException { if("visa".equals(transaction.getType())){ //pay with…

Keep reading