Home
Burak Aktas
Cancel

CDI Dependency Injection @PostConstruct and @PreDestroy Example

We have seen how to inject cdi beans by using qualifiers and producers so far. Additionally, every cdi bean has a lifecycle, and we can initialize and prepare to destroy any managed bean by using t...

Java Enums Tutorial

Enums (Enumeration) are introduced as a new reference type in Java 1.5 with a bunch of beneficial features. They consist of fix set of constants (each constant is implicitly labeled as public stati...

CDI Dependency Injection Producer Method Example

In this tutorial we will see how to use producer methods for injecting CDI beans by using @Produces annotation. We will use Weld CDI implementation. Using producer methods provides a programmatic w...

Adapter Design Pattern in Java

Adapter design pattern is a structural design pattern that provides two unrelated interfaces to work together. The most common illustration about adapter design pattern is sockets from different co...

Create Qualifiers for CDI Beans

As I described in my previous [post][1], we can define and inject cdi beans by @Named annotation. Well according to the CDI specification (JSR-299) injecting beans by their names is legacy and tend...

Convert objects to/from JSON by Jackson example

We will see a simple example about converting objects to/from JSON objects in Java by Jackson. First, add maven dependency for jackson. <dependency> <groupId>com.fasterxml.jack...

Arquillian Example for CDI Dependency Injection

Arquillian is a platform which provides integration tests by deploying, running containers so that we can easily use cdi beans in tests. In this tutorial we will see how to inject and use cdi beans...

Java CDI Dependency Injection Example

CDI (Context and Dependency Injection) is a specification defined in JSR-299. Major aim is loose coupling by dependency injection.In this tutorial we will see how to use CDI Dependency Injection in...

Graphs

Graphs are data structures to represent road networks, the web, social networks etc. Moreover, hundreds of computational problems are related to graphs.They have two main ingredient which are; ...

Quicksort

Quicksort is a sorting algorithm which applies divide and conquer paradigm. Quicksort has a worst case running time of \( O(n^{2}) \) , however, it has running time of \( O(n​ logn) \) on average w...