Thrift Project Server-side development process

Source: Internet
Author: User

Thrift Project Server-side development process

First, understand the functionality of all packages in the project (see)

The diagram is the directory structure of the User Center project, which is described in turn below.

    1. 1. Src/main/java

Com.framework: This directory holds some of the common classes required for all systems.

Com.user: This package is under the function code of this group.

DAO: This layer mainly holds the method of invoking the database layer

Entity: Business entity Bean

Mapper: Business SQL

Implementation class for the Service:thrift interface

Thrift:thrift IDL-generated Java files

Com.utoken.table: This store mybatis the Mapper and DAO required for single-table operation, and can operate quickly on a single table.

    1. 2. src/main/resources

Config: Storage package for configuration files

LOG: Store log4j configuration file

MyBatis: Here is the configuration file for MyBatis

Configuration file for spring:spring

System:applicationcontext configuration file

Thrift:thrift client and server-side configuration files

Thrift-idl: Storing the Thrift IDL file, which is not useful in the system, but facilitates the developer to quickly understand the definition specification of the interface.

    1. 3. Web-inf

Store Logs,web.xml and Proxool.xml (the file cannot be found at compile time under Config, so it can only be placed here).

At this point, the directory structure of the project is complete.

The development process is divided into two ways: simple single-table operation and complex operation.

Note: The single-table operation can be used as far as possible to achieve the implementation of single table, improve development efficiency.

Simple single-table operation specific process:

A single table operation can be implemented directly using the single-table operation class generated by MyBatis, with the following details:

For a single-table operation, you can quickly complete a single table operation by adding only two of the contents of the red circle.

Lineaskserviceimpl: This class is the implementation of the Lineaskservice interface and is also the main function module.

The simple process of the entire single-table operation has been briefly described.

Complex Operating Procedures:

The red area is a required file, which is created in the corresponding way, with the class name Convention rule: The service name is added to the corresponding package name.

The features of each file are not described here, the Spring framework is based on the relevant documentation.

    1. The contents of DAO are as follows:

The contents of 2.Mapper are as follows:

3.Entity content is no longer described in detail, see

4. Authoring of interface Implementation classes

After the operation of the above step, you can perform service configuration work.

Configure Thrift-service.xml

There is a new interface that adds a new service interface bean to the red zone, sequentially adding the bean to the thriftserverlist. After the operation of the above step, you can publish the service.

Thrift Project Server-side development process

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.