Search results for: Java

In this blog post, I will share how to create a very simple RESTful Spring Boot Web Service that uses Spring Data JPA to save information to a database. Our Web Service will accept HTTP Post requests with user details and then save these user details into MySQL Database using Spring Data JPA CrudRepository. For code…

Read More Spring Boot REST and JPA – Save to a Database

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 Kotlin programming tutorial I am going to share with you how to load image from a remote URL in Kotlin using Glide. Glide is probably the easiest and the most efficient way to load image to an ImageView.  You can use Glide to load a local image and well as an image hosted on a remote…

Read More Load Image From a Remote URL with Kotlin and Glide

In this short Kotlin programming tutorial we will learn how to create a Switch in Kotlin programmatically. In the code example below we are going to cover: Create Switch and add it to a LinearLayout Get input from the Switch when it’s state is changed  Set textOff and textOn text programmatically Set OnClickListener on the…

Read More Create a Switch in Kotlin Programmatically

In this short Kotlin programming tutorial I am going to share with you how to create a CheckBox in Kotlin programmatically. You will learn how to create two checkboxes and how to read a value from CheckBox when it is selected. The code example below with cover: Create CheckBox in Kotlin programmatically, Use setOnClickListener to know when check…

Read More Create Checkbox in Kotlin Programmatically

In this short Kotlin tutorial I am going to share with you how to create a TimePicker in Kotlin programmatically and how to update text label when the value of Hours or Minutes has changed. The below code example will cover: Create TimePicker and add it to LinearLayout Get input from TimePicker when user changes the value…

Read More Create TimePicker in Kotlin Programmatically

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