Java Program API Data interface __api

Source: Internet
Author: User

API: Application Interface (api:application program Interface)

the function of using data interface

1. Encapsulation logic

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

2, Easy distribution deployment

Multiple APIs can be deployed to facilitate the use of several terminals

3. Improve security

Avoids direct access to the database from the app side

Figure 1 The API is a bridge between the application cluster and the database


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, there are four types of APIs that can be grouped:
Remote Procedure Call (RPC): To implement communication between programs by acting on a shared data buffer (or task);
Standard Query Language (SQL): A standard query language for accessing data, which enables data sharing among applications through a common database;
File transfer: File transfer enables data sharing between applications by sending format files;
Information delivery: Refers to loosely coupled or tightly coupled application of small format information, through the direct communication between programs to achieve data sharing.

second, the project builds (code Http://pan.baidu.com/s/1i5nrT9V)

1. Technology selection: Using Springmvc+mybatis jdk1.7 TOMCAT7

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

2. Project Build

-1 Pom.xml

-2 Web.xml

-3 Pring-servlet.xml

-4th Log configuration file

-5 Database Connection properties file

-6 MyBatis configuration file

3. Code writing (according to personal custom positive sequence, reverse writing) (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: APIs differ from graphical user interface (GUI) or command interface: API interfaces belong to an operating system or program interface, both of which belong to the direct user interface.

Hope to be helpful to you, wish you have a good mood, refuels.

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.