Tiven Wang
Wang Tiven February 23, 2017
425 favorite favorites
bookmark bookmark
share share

The project codes for this article can be downloaded from Github.

Spring helps development teams everywhere build simple, portable, fast and flexible JVM-based systems and applications. Spring has a lot of projects for whatever the infrastructure needs of your application may be, from configuration to security, web apps to big data, there is a Spring Project to help you build it. Start small and use just what you need.

We used Spring projects:

  • Spring Data JPA: The goal of Spring Data repository abstraction is to significantly reduce the amount of boilerplate code required to implement data access layers for various persistence stores.
  • Spring Data Rest: Spring Data REST builds on top of Spring Data repositories and automatically exports those as REST resources. It leverages hypermedia to allow clients to find functionality exposed by the repositories and integrates these resources into related hypermedia based functionality automatically.
  • Spring Data RestDocs: The aim of Spring REST Docs is to help you to produce documentation for your RESTful services that is accurate and readable.

Spring Data JPA

Add Dependencies


Spring Configuration

The configuration set up Spring to create proxy instances for those interfaces:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  <jpa:repositories base-package="com.sap.c4c.wechat.repository"/>

Declare Repository

package com.sap.c4c.wechat.repository;

import java.util.List;

import org.springframework.data.repository.CrudRepository;
import com.sap.c4c.wechat.model.Message;

public interface MessageRepository extends CrudRepository<Message, Long> {
	List<Message> findByType(String type);

Similar Posts


Back to Top