Spring Shell Generator is a CLI tool that allows you to generate Spring Boot components (Controller, Service, Repository) directly from the command line.
π― Features
- Easily generate Spring Boot components with a single command.
- Supports Controller, Service, and Repository creation.
- Seamlessly integrates with any Java/Spring Boot project.
Follow these steps to install and use the tool.
From the root of your project, run:
mvn clean install
If you have Spring Boot configured, the JAR file will be located at:
target/spring-shell-generator-0.1.jar
Follow these steps to easily run the spring-shell.jar from any terminal window.
-
Create a Directory for the JAR File
Open File Explorer and navigate to your C: drive or User folder under C. Create a new folder called tools in the root of the C: drive. Right-click and select New > Folder. Name the folder tools.
-
Move and Rename the JAR File
Move the spring-shell.jar file into the C:\tools directory. Rename the file to spring-shell.jar (if it's not already named that).
-
Set Up an Environment Variable
Open the System Properties: Press Win + X and select System. Click Advanced system settings on the left. Click the Environment Variables button at the bottom. Create a new system environment variable: Under System variables, click New. For Variable name, enter SHELL_HOME. For Variable value, enter C:\tools. Click OK to save.
-
Create a Batch File to Run the JAR
Open Notepad and create a new file.
Add the following line to the file:
java -jar C:\tools\spring-shell.jar
Save the file as spring-shell.bat in the C:\tools folder. Make sure to select All Files under "Save as type" when saving the file.
-
Test the Setup
Open a Command Prompt window (press Win + R, type cmd, and press Enter). Type spring-shell and press Enter. The Spring Shell JAR should now run, and you can access it from any terminal.
Now you can generate components anywhere in your project! Navigate to your project folder and run:
spring-shell
If everything is set up correctly, this will open our Spring Shell to generate Controller, Service, and Repository files in your project.
Use following command to generate all three components or use appropriate flag :
g -n User --all
π’ Contributing
If you want to improve the project, feel free to open a Pull Request or report an issue in the Issues section.
π Your generator is now ready to use in any project! π