Self-proactive restful development based on reflection

Source: Internet
Author: User

[Author]: Kwu

Based on reflection to implement their own proactive restful development, the general only need to write query database SQL. and increase the corresponding javabean realization of high-speed restful service development.


1, write the database query SQL. corresponding sql.properties

Daily = Dailyreport;select T.day,t.cnt,t.type from (select Day,cnt,type from Dailyreport where type=? ORDER BY day Desc Li Mit?

) t order by T.day; String,integer


SQL properties file to ";" Separated.

Description

1) PV is the label for the SQL.

2) The first number of parameters is. Dailyreport the class name for the corresponding JavaBean

3) The second parameter is the SQL for the query, with the "?" placeholder

4) The third parameter is the type of the parameter, separated by ","


2, write the corresponding Pojo class

Import Com.hexun.bean.base.chartsdata;public class Dailyreport implements Chartsdata {private String day, Type;private Integer cnt;public String GetDay () {return day;} public void Setday (String day) {this.day = day;} Public String GetType () {return type;} public void SetType (String type) {this.type = type;} Public Integer getcnt () {return CNT;} public void setcnt (Integer cnt) {this.cnt = cnt;}}

3. Start a RESTful service interview

Http://localhost:9088/restful?tag=pv&args=3

Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center "alt=" "/>



With Reflection DAO Implementations:

< slightly ....>


Self-proactive restful development based on reflection

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.