Jersey + Spring integration example

This tutorial show you how to integrate Jersey web application with Spring framework. Technologies used : Jersey 1.8 Spring 3.0.5.RELEASE Eclipse 3.6 Maven 3 1. Project Dependency Declares Jersey 1.8, Spring3 and “jersey-spring.jar” dependencies in Maven pom.xml file. Note In “jersey-spring.jar” version, it will download all the Spring 2.5.6 dependencies. To use Spring 3, you …

Read more

XML example with Jersey + JAXB

This tutorial show you how to use JAXB to convert object to XML in Jersey, and return it back to user. 1. Dependency To integrate JAXB with Jersey, no extra dependency is required. Just include “jersey-server.jar” will do. 2. JAXB Annotation Annotate object with JAXB annotation, for conversion later. import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; …

Read more

Integrate Maven with Eclipse via External Tool Configuration

During Eclipse development, it’s not practical to go outside of the Eclipse’s environment and execute Maven command in external console. In this article, we show you how to integrate Maven command with Eclipse IDE, via Eclipse’s “External Tool Configuration“. Normally, this external tool is used to run external command within Eclipse environment, and it works …

Read more

JAX-WS + Spring integration example

Here’s a guide to show you how to integrate Spring with JAX-WS, as mention in this link : http://jax-ws-commons.java.net/spring/. Upon finishing this tutorial, you will create a simple HelloWorld web service (JAX-WS), and DI a bean into the web service via Spring. 1. Project Folder See the final project folder structure. 2. Project Dependencies Use …

Read more

JAX-WS + Java Web Application Integration Example

Often times, JAX-WS always be part of your Java web application. Here we show you how to integrate JAX-WS into Java web application easily. 1. Project Folder First, review this project folder structure. 2. Web Service A super simple web service. Code is self-explanatory. File : HelloWorld.java package com.mkyong.ws; import javax.jws.WebMethod; import javax.jws.WebService; @WebService public …

Read more

JSF 2.0 + JDBC integration example

Here’s a guide to show you how to integrate JSF 2.0 with database via JDBC. In this example, we are using MySQL database and Tomcat web container. Directory structure of this example 1. Table Structure Create a “customer” table and insert five dummy records. Later, display it via JSF h:dataTable. SQL commands DROP TABLE IF …

Read more

JSF 2 + Spring 3 integration example

In this tutorial, we will show you how to integrate JSF 2.0 with Spring 3 using : JSF XML faces-config.xml Spring annotations JSR-330 standard injection Tools and technologies used : JSF 2.1.13 Spring 3.1.2.RELEASE Maven 3 Eclipse 4.2 Tomcat 6 or 7 1. Directory Structure A standard Maven project for demonstration. 2. Project Dependencies Declares …

Read more

Spring + JDK Timer scheduler example

Note Learn the JDK Timer scheduler example without Spring and compare the different with this example. In this example, you will use Spring’s Scheduler API to schedule a task. 1. Scheduler Task Create a scheduler task… package com.mkyong.common; public class RunMeTask { public void printMe() { System.out.println("Run Me ~"); } } <bean id="runMeTask" class="com.mkyong.common.RunMeTask" /> …

Read more

Spring + JdbcTemplate + JdbcDaoSupport examples

In Spring JDBC development, you can use JdbcTemplate and JdbcDaoSupport classes to simplify the overall database operation processes. In this tutorial, we will reuse the last Spring + JDBC example, to see the different between a before (No JdbcTemplate support) and after (With JdbcTemplate support) example. 1. Example Without JdbcTemplate Witout JdbcTemplate, you have to …

Read more

Spring + JDBC example

In this tutorial, we will extend last Maven + Spring hello world example by adding JDBC support, to use Spring + JDBC to insert a record into a customer table. 1. Customer table In this example, we are using MySQL database. CREATE TABLE `customer` ( `CUST_ID` int(10) unsigned NOT NULL AUTO_INCREMENT, `NAME` varchar(100) NOT NULL, …

Read more

Maven 2 + Hibernate 3.2 + MySQL Example (Annotation)

Note This article is outdated, and some information is no longer valid in latest Hibernate development. You should refer to this latest – Maven 3 + Hibernate 3.6.3 + Oracle 11g Example (Annotation) tutorial. This tutorial will modify the previous Maven 2 + Hibernate 3.2 + MySQL Example (XML mapping), and replace the Hibernate XML …

Read more