SPRINGBOOTRESTFULAPI Platform Project-Demo Version 01

Source: Internet
Author: User

Project implementation features: interface test Case automation

=========================================== table Design Phase ==================================

1. Design Database and table (4 sheets)

Database name: Restfulapi

Table name: projecttable field: Id,projectname,username,createtime,onlinetime,requiredoc,redmineaddress,mark;

Table name: casetable field: Id,projectname,casename,casedescri,interfaceurl,requiretype,requireparam,checkpoint, Expectoutput,operationedit,operationdelete;

Table name: alreadyexeccasetable field: id,projectname,casename,testresult,consumetime,responsedata,execdate;

Implementing database tables in =========================================== projects ===========================

2. Create a new RESTFULAPI database using the NAVICAT database software

Springboot maven Project for new Springbootrestfulapi in 3.eclipse

4. New 3. YML Profiles under Project Resources directory: Application.yml and Application-test.yml and APPLICATION-ONLINE.YML

5. Configure in 3 yml files, respectively (e.g.)

6. Add the dependent jar package in the project Pom.xml file:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

7. Create a new DB package in the Project Web bundle, create a new 4 Entity entity class in DB, corresponding to the database 4 tables and their fields (for example)

8. Running the project run as, Spring Boot app, refresh the database viewer to automatically create 4 data tables corresponding to the entity class

9. Change the ddl-auto:create in the Application.yml file to update

=========================================== in the back-segment architecture implementation ==================================

10. Create a new Web package in the demo directory and create a new DAO package in the Web, and create 4 separate interfaces in DAO that inherit from jparepository<,>:

Projecttableinterface and inherited from extends Jparepository<projecttable, integer>

Casetableinterface and inherited from extends Jparepository<casetable, integer>

Alreadyexeccasetableinterface and inherited from extends Jparepository<alreadyexeccasetable, integer>

Reporttableinterface and inherited from extends Jparepository<reporttable, integer>

11. Create a new Web service package in the demo directory and create a new 4 class for the database operation in the service:

Projecttabledb, Casetabledb, Alreadyexeccasetabledb, Reporttabledb

12. Create a new Web controller package in the demo directory and temporarily build 3 controller classes in the Controller for Business logic processing:

Projectcontroller, Casecontroller, Reportcontroller

=========================================== front-end h5 page implementation ==================================

The 13.maven project Pomx.xml file introduces a front-end template Jar Package dependency:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

14. Add thymeleaf template configuration information in the Src/main/resources directory application.yml configuration file:

Spring

Thymeleaf
prefix:classpath:/templates/
Suffix:. html
Cache:false

15. Create a new HTML file directly under the project templates directory, such as index.html

16. Edit the Projectcontroller class in the Controller directory

17. Run the project run as, Spring Boot app, then enter Http://localhost:8080/project/index in the browser to view the results returned by the browser

SPRINGBOOTRESTFULAPI Platform Project-Demo Version 01

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.