Java Program API Data interface

Source: Internet
Author: User

API: Application Interface (api:application program Interface)

I. The role of using data interfaces

1. Package Logic

The data interface queries the data from the database and organizes it into JSON format, which, if written once at each terminal, will write a lot of duplicate code

2. Easy Distribution Deployment

Multiple APIs can be deployed for multi-terminal use

3. Improve safety

Avoid direct access to the database from the app side

Figure 1 API is a bridge connecting application clusters to databases


The API is also a middleware that provides data sharing for a variety of different platforms. Depending on the performance of data sharing between different software applications on a single or distributed platform, you can divide the API into four categories:
Remote Procedure Call (RPC): Implements communication between programs through a process (or task) that acts on a shared data cache;
Standard Query Language (SQL): is the standard query language to access data, through the common database to achieve data sharing between applications;
File transfer: File transfer enables data sharing between applications by sending a format file;
Information delivery: Refers to loosely coupled or tightly coupled application of small format information, through the direct communication between programs to achieve data sharing.

Ii. Construction of the Project (Code Http://pan.baidu.com/s/1i5nrT9V)

1. Technology selection: Use Springmvc+mybatis jdk1.7 tomcat7

(Note: There is no session, only data interface, through the controller in the SPRINGMVC to provide data services, using @responsebody annotations to convert data into a JSON array)

2. Project Construction

-1 Pom.xml

-2 Web

-3 Pring-servlet.xml

-4th Log configuration file

-5 Database Connection properties file

-6 MyBatis configuration file

3. Code writing (according to personal habits, written in reverse order) (using MyBatis)

-1 DAO Interface Class

-2 Mapping file

-3 entity Class code

-4 Service Interface Class

-5 Service Implementation Class

-6 Controller class

Another: API and graphical user interface (GUI) or command interface has a distinct difference: API interface belongs to an operating system or program interface, and then both belong to the direct user interface.

Hope to help you, wish you have a good mood, refueling! Welcome and attention to my blog: http://www.hm5656.com/http://www.enniscarpentry.com/

Java Program API Data interface

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.