Spring Data REST + GemFire + AngularJS Integration
来源:互联网 发布:傻瓜p图软件 编辑:程序博客网 时间:2024/05/02 05:00
This tutorial explains the integration between Spring Data REST, GemFire and AngularJS frameworks. We are going to develop a REST service which returns the JSON response and that will be accessed by the AngularJS web page.
- Tools Required
We’ve developed this tutorial by using the following tools:
JDK 1.6.
Tomcat 7.
Maven 3.
GemFire 7.0.1.
AngularJS
2. Project Structure
Here is the project structure used for this tutorial.
Spring REST - GemFire - Eclipse Project Directory
3. Business Domain
Message is the persistence object used for storing the data in GemFire’s in-memory storage. We are using only this entity for this tutorial. If you look at the below code, the entity imports the org.springframework.data.gemfire.mapping.Region which is equivalent to the table in the relational database. This Region class used as the segment in in-memory and allocate the storage for the data.
Message.java
package net.javabeat.springdata.data;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.gemfire.mapping.Region;
@Region(“messages”)
public class Message {
@Id
private String messageId;
private String message;
public Message() {
}
@PersistenceConstructor
public Message(String id, String message) {
this.messageId = id;
this.message = message;
}
public String getMessageId() {
return messageId;
}
public void setMessageId(String messageId) {
this.messageId = messageId;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
4. Spring Data Repository
It’s the repositories that enable the CRUD operations against the business domain. In our previous tutorial I have explained theSpring Dataand how the repositories used for the CRUD operations.
MessageReposirory.java
package net.javabeat.springdata.repo;
import net.javabeat.springdata.data.Message;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel=”messages”,path=”messages”)
public interface MessageRepository extends CrudRepository
- Spring Data REST + GemFire + AngularJS Integration
- Spring MVC + AngularJS Integration
- spring integration之http rest
- spring boot 2.0把spring boot data gemfire移除了
- 8.3 Spring Data REST
- Spring Data REST
- spring integration之http-rest例子解析
- Spring-data-rest 和Spring-data-jpa
- Hibernate data validator in spring integration
- Spring Data Redis(Repositories-CDI integration)
- spring boot data rest 3
- SpringBoot之Spring Data REST
- gemfire 集成spring
- spring boot 使用 spring data rest
- Spring Data Rest如何暴露ID字段
- Spring Data Rest学习篇----@Excerpts
- Spring Data Rest学习篇----@Projection
- Spring Data Rest学习篇----@Repository
- 一个故事讲清楚 NIO
- USACO 1.2 Name That Number (查字典)
- 从单片机读程序,然后下到另一个单片机
- Activity的四种启动模式(LaunchMode)
- WWW-JSON
- Spring Data REST + GemFire + AngularJS Integration
- 欢迎使用CSDN-markdown编辑器
- 华为 字符逆序
- java笔记--java异常处理机制
- html自定义标签属性的例子
- c语言
- Network Lasso: Clustering and Optimization in Large Graphs
- 终极优化Adapter
- jdk/java版本与Android源码编译中的错误