Generate Spring Boot CRUD Code Instantly with EasyCode Plugin

This tutorial walks you through installing the EasyCode IntelliJ plugin, creating a MySQL database, configuring IDEA’s database connection, setting up Maven dependencies and application.yml, generating entity, DAO, service, and controller code automatically, and finally running the Spring Boot project.

Java Backend Technology
Java Backend Technology
Java Backend Technology
Generate Spring Boot CRUD Code Instantly with EasyCode Plugin

1. Install EasyCode

Install the EasyCode plugin in IntelliJ IDEA, which can generate entity, controller, service, DAO, and mapper code directly from database tables without manual coding.

2. Create Database

-- ----------------------------
-- Table structure for user
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `username` varchar(20) DEFAULT NULL,
  `sex` varchar(6) DEFAULT NULL,
  `birthday` date DEFAULT NULL,
  `address` varchar(20) DEFAULT NULL,
  `password` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;

3. Configure IDEA Database Connection

In a new Spring Boot project, open the Database tool window, add a new MySQL connection, fill in the database name, username, and password, then click OK.

4. Generate Code

Right‑click the desired table in the EasyCode panel, choose the target folder, select the code types to generate, and confirm. The generated files are displayed.

5. pom.xml Dependencies

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
</dependency>
...
<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <optional>true</optional>
</dependency>
...
<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>druid</artifactId>
    <version>1.0.9</version>
    <optional>true</optional>
</dependency>
...
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.47</version>
</dependency>

6. application.yml Configuration

server:
  port: 8089
spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/database?useUnicode=true&characterEncoding=UTF-8
    username: root
    password: 123456
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.jdbc.Driver
mybatis:
  mapper-locations: classpath:/mapper/*Dao.xml
  typeAliasesPackage: com.vue.demo.entity

7. Run the Project

Add @Mapper to DAO interfaces and @MapperScan("com.vue.demo.dao") to the main application class, then start the Spring Boot application and test the generated endpoints.

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.

JavaCode GenerationSpring BootMySQLIntelliJ IDEAEasyCode
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

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.