Spring Cloud Practical Project – Automatic Front‑Back End Code Generation Tutorial

This tutorial walks through setting up a Spring Cloud micro‑service project by cloning a code‑generator framework, adding backend code, configuring database and Maven settings, launching the generator service, generating CRUD code, and integrating a common utility module with required dependencies.

Wukong Talks Architecture
Wukong Talks Architecture
Wukong Talks Architecture
Spring Cloud Practical Project – Automatic Front‑Back End Code Generation Tutorial

This guide demonstrates how to build a Spring Cloud micro‑service project with automatic front‑back end code generation.

1. Download the code generator git clone https://gitee.com/renrenio/renren-generator.git 2. Add Renren Fast backend code

Copy the renren-fast folder into the PassJava project root and update the pom.xml with the module entry: <module>renren-generator</module> 3. Modify configuration files

Update src/main/resources/application-dev.yml with your MySQL connection, e.g.:

url: jdbc:mysql://129.211.188.xxx:3306/passjava_qms?useUnicode=true&characterEncoding=UTF-8&useSSL=false<br/>username: root<br/>password: root

Edit src/main/resources/generator.properties to set package, module name, author, etc.

# 以question微服务为例<br/>mainPath=com.jackson0714<br/>package=com.jackson0714.passjava<br/>moduleName=question<br/>author=jackson0714<br/>[email protected]<br/>tablePrefix=qms_

4. Adjust controller template

Remove the import of org.apache.shiro.authz.annotation.RequiresPermissions and comment out the @RequiresPermissions annotation in src/main/resources/template/Controller.java.vm.

5. Start the generator service

Run the application and open http://localhost to view the tables of the qms database.

6. Generate code

Click the generate button; the service produces controller, DAO, entity, service implementation, and mapper files.

7. Add a common module

Create a Maven module passjava-common and add it as a dependency to the question module:

<dependency>
    <groupId>com.jackson0714.passjava</groupId>
    <artifactId>passjava-common</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>

8. Add required dependencies to the common module

MyBatis‑Plus

Lombok

httpcore

commons‑lang

servlet‑api (provided scope)

Each dependency is declared in the common module's pom.xml as shown in the original guide.

9. Add utility classes

Copy utility classes such as Constans.java, PageUtils.java, Query.java, R.java, and RRException.java from the Renren Fast project into com.jackson0714.common.utils, and add XSS/SQL filter classes under com.jackson0714.common.xss.

The result is a fully functional Spring Cloud micro‑service with generated CRUD code and a shared common library for utilities and dependencies.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

mavenmybatis-plusSpring Cloud
Wukong Talks Architecture
Written by

Wukong Talks Architecture

Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.