Building Schneider Building Control system Database Backend Server example Project II (database query writing)

Source: Internet
Author: User

Construction of Schneider Building control system Database Backend Server example project-(project creation) records how a spring, Hibernate, and Rest project is created, this article will briefly describe how to use annotation programming in this framework.

1.Spring comments

Spring provides us with @service, @Autowired these annotations to automate the creation of beans in your project.

In our framework, we need to add a @service tag to each class name that needs to be called by another class, add @autowired on the member class that needs to be created automatically, and spring will automatically assemble the relevant class instance for us at run time.


2.Rest comments

Rest is that we can use the "/" in a resource list to access our backend services on the web side, rest annotations have @get, @Post, @Put corresponding to the servlet in the Doget, DoPost, Doput method, It also has annotations for configuring the Rest access path @path

(PS: Because rest is also created automatically by the spring framework when the program is running in this project, you also need to add @service tags)

@Path ("Testrest") @Servicepublic class Testrest {@Autowiredprivate testservice testservice; @GET @Path ("test") public String Test () {Duplicatevaluetypemodel model = Testservice.getid (1); return "Rest (" +model.getduplicatevaluetypeid () + " , "+model.getname () +") ";}}

The rest access path to the above code is:


The project has not been fully organized, only to achieve the database query, followed by the completion of the code, the first place the code in this.


Building Schneider Building Control system Database Backend Server example Project II (database query writing)

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.