Java

In this blog post, I am going to share with you how to configure Spring Data JPA in a Jersey 2 Container Deployable Web App. Spring Data JPA makes it much easier and more convenient to persist and read data from the database and when I needed to tie together Spring Data JPA and Jersey 2 Web…

Read More Configure Spring Data JPA in Jersey 2 JAX-RS App

With this blog post, I am going to share what I needed to do to make JPA work in my Jersey 2 Web Services App. I have created my Jersey 2 app using the following maven snippet: mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes \ -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.26 I then opened pom.xml and added a few new dependencies which I…

Read More Configuring JPA in Jersey 2 Web App

Adding dependency injection support into Jersey 2 Web Services application that uses HK2 is not very straightforward. So, I created this page to document things I needed to do in my Jersey 2 RESTful Web Services app to make the Dependency Injection work. Hope you will find it useful. Create a new class that extends AbstractBinder. This…

Read More Dependency Injection with HK2 in Jersey and JAX-RS

Create a Servlet Container deployable Jersey web application Create new Jersey web application using Maven. The project created with the below jersey-quickstart-webapp archetype can be built and deployed to a servlet container like for example Apache Tomcat. mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes \ -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.26 POM.XML Dependency to Support JSON To support JSON in your Jersey Web App add…

Read More RESTful Web Services with Jersey and Spring Data JPA – Cheat Sheet

Recently I have published a video course that teaches how to use Java JAX-RS to create a RESTful Web Service for your mobile application and how implement features like user Sign up, Sing in and how to communicate with protected Web Service Endpoints. I would love it if you check it out and hopefully like it, find…

Read More Deploy Web Application Archive(WAR) to Amazon AWS EC2 Linux Instance

In this blog post I would like to share with you how to use Java 8 Functional Interfaces and how to create your own functional interface. What is Functional Interface? Functional interface is a Java interface with single abstract method. Below is a very simple example of a functional interface: package com.appsdeveloperblog; @FunctionalInterface public interface MyFunction<A,…

Read More Java 8 Functional Interface Tutorial

In this short Java programming tutorial I am going to share with you how to take a String value and Base64 encode it. We will then take the Base64 encoded String value and will decode it back into original String. There are different libraries out there that allow us to use Base64 encoding and decoding and…

Read More Base64 Encoding and Decoding Example in Java

In this Java programming tutorial I would like to share with you a sample Java code that uses Amazon AWS SES(Simple Email Service) Java SDK to send an email message. I used this code implement Email Verification feature for my mobile app. The code below would send an email message containing an email verification link…

Read More Send Email Message Using AWS SES Java SDK

When you start building a mobile app most likely you will need to build pages like user Sign up and once user has successfully registered, you will need to create a Sign in page. I have created many video tutorial how to implement these pages in Swift and if you follow those you will no doubt…

Read More REST API with Java JAX-RS. Create and Deploy to Amazon Cloud.

With this tutorial I wanted to share with you how to configure your Java project and it’s hibernate configuration file hibernate.cfg.xml to use a more professional and production ready connection pool provider C3P0. Hibernate’s internal connection pooling algorithm is rudimentary, and is provided for development and testing purposes. In my earlier blog posts I used…

Read More Configure Hibernate to Use C3P0 Connection Pool

In this Java tutorial I am going to share with you how to create an Anonymous java class and also how to Replace Java Anonymous Class with a shorter lambda expression. Let’s start by creating and interface which we will use in this tutorial. Our anonymous java class will implement a single method defined in this java…

Read More Replace Anonymous Java Class with Lambda Expression

In this short code example I am going to share with you how to concatenate two ArrayList in Java.  Concatenate ArrayList using addAll() function Let’s say we have these two ArrayList(s): List<String> itemsList1 = new ArrayList(Arrays.asList(“One”, “Two”)); List<String> itemsList2 = new ArrayList(Arrays.asList(“Three”, “Four”)); To concatenate the two lists together we can create a new ArrayList, and…

Read More Concatenate Two ArrayList in Java