Skip to content

andersonbuzzi/springbuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Spring Boot Project Builder

This command-line tool helps you quickly bootstrap new Spring Boot projects and generate standard entities with associated layers such as DTOs, Mappers, Controllers, Services, Repositories, and database migrations.

Features

  • Interactive or argument-based project generation.
  • Automatic download and setup of Spring Boot starter projects.
  • Generates fully wired entity classes including:
    • Java Entity
    • DTO
    • Mapper
    • Controller
    • Service
    • Repository
    • SQL migration script
  • Generates a builder.properties file to store project configuration.

Requirements

  • Java 21+
  • Maven

Getting Started

1. Build the JAR

Clone the repository and run:

mvn clean package

This will generate a file like target/springboot-builder.jar

2. Create a New Spring Boot Project

Run in interactive mode:

java -jar target/springboot-builder.jar start-springboot

Or with arguments:

java -jar target/springboot-builder.jar start-springboot 3.4.5 21 demo com.example demo demo com.example.demo web,data-jpa,postgresql,lombok,validation ./ localhost 5432 postgres public dbuser dbpassword

3. Add an Entity

Interactive mode:

java -jar target/springboot-builder.jar add

Or via command-line arguments:

java -jar target/springboot-builder.jar add Entity fieldName:FieldType

Example:

java -jar target/springboot-builder.jar add Company name:String
java -jar target/springboot-builder.jar add Branch name:String company:Company foundingDate:LocalDate

This will generate:

  • Entities: Company.java and Branch.java
  • DTOs: CompanyDTO.java and BranchDTO.java
  • Mappers: CompanyMapper.java and BranchMapper.java
  • Services: CompanyService.java and Branch.java
  • Controllers: CompanyController.java and Branch.java
  • Flyway migration script: V__x__create_{company}.sql and V__x+1__create_{branch}.sql

x is the next version based on existing migrations

Notes:

  • Add * to indicate a required field: name:String*
  • For enums, list the enum values inside < >: status:Status<ACTIVE, INACTIVE, SUSPENDED>

Configuration

After creating the project, a builder.properties file is generated to define paths for each component (entities, controllers, services, etc.). This file is used by the entity generator to locate and organize the source code.

Example:

builder.path=./demo
builder.package=com.example.demo
builder.entitypath=/entity
builder.controllerpath=/controller
builder.servicepath=/service
builder.repositorypath=/repository
builder.dtopath=/dto
builder.mapperpath=/mapper
builder.enumpath=/enums
builder.migrationpath=/src/main/resources/db/migration

Notes

  • This tool is ideal for backend developers who prefer working from the terminal.
  • The SQL script is generated based on the entity definition and placed under the Flyway migrations folder.

License

This project is open source and contributions are welcome. Feel free to fork, copy, or submit pull requests.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages