Skip to content

Commit cfe6221

Browse files
Add prompt for creating Spring Boot Kotlin project skeleton
1 parent 5d1f034 commit cfe6221

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Ready-to-use prompt templates for specific development scenarios and tasks, defi
5454
| [Azure Cost Optimize](prompts/az-cost-optimize.prompt.md) | Analyze Azure resources used in the app (IaC files and/or resources in a target rg) and optimize costs - creating GitHub issues for identified optimizations. | [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Faz-cost-optimize.prompt.md) [![Install in VS Code](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Faz-cost-optimize.prompt.md) |
5555
| [Comment Code Generate A Tutorial](prompts/comment-code-generate-a-tutorial.prompt.md) | Transform this Python script into a polished, beginner-friendly project by refactoring the code, adding clear instructional comments, and generating a complete markdown tutorial. | [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcomment-code-generate-a-tutorial.prompt.md) [![Install in VS Code](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcomment-code-generate-a-tutorial.prompt.md) |
5656
| [Create Spring Boot Java project prompt](prompts/create-spring-boot-java-project.prompt.md) | Create Spring Boot Java project skeleton | [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcreate-spring-boot-java-project.prompt.md) [![Install in VS Code](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcreate-spring-boot-java-project.prompt.md) |
57+
| [Create Spring Boot Kotlin project prompt](prompts/create-spring-boot-kotlin-project.prompt.md) | Create Spring Boot Kotlin project skeleton | [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcreate-spring-boot-kotlin-project.prompt.md) [![Install in VS Code](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcreate-spring-boot-kotlin-project.prompt.md) |
5758
| [C# Async Programming Best Practices](prompts/csharp-async.prompt.md) | Get best practices for C# async programming | [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcsharp-async.prompt.md) [![Install in VS Code](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcsharp-async.prompt.md) |
5859
| [C# Documentation Best Practices](prompts/csharp-docs.prompt.md) | Ensure that C# types are documented with XML comments and follow best practices for documentation. | [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcsharp-docs.prompt.md) [![Install in VS Code](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcsharp-docs.prompt.md) |
5960
| [MSTest Best Practices](prompts/csharp-mstest.prompt.md) | Get best practices for MSTest unit testing, including data-driven tests | [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcsharp-mstest.prompt.md) [![Install in VS Code](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcsharp-mstest.prompt.md) |
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
---
2+
mode: 'agent'
3+
tools: ['changes', 'codebase', 'editFiles', 'findTestFiles', 'problems', 'runCommands', 'runTests', 'search', 'searchResults', 'terminalLastCommand', 'testFailure', 'usages']
4+
description: 'Create Spring Boot Kotlin project skeleton'
5+
---
6+
7+
# Create Spring Boot Kotlin project prompt
8+
9+
- Please make sure you have the following software installed on your system:
10+
11+
- Java 21
12+
- Docker
13+
- Docker Compose
14+
15+
- If you need to custom the project name, please change the `artifactId` and the `packageName` in [download-spring-boot-project-template](./create-spring-boot-kotlin-project.prompt.md#download-spring-boot-project-template)
16+
17+
- If you need to update the Spring Boot version, please change the `bootVersion` in [download-spring-boot-project-template](./create-spring-boot-kotlin-project.prompt.md#download-spring-boot-project-template)
18+
19+
## Check Java version
20+
21+
- Run following command in terminal and check the version of Java
22+
23+
```shell
24+
java -version
25+
```
26+
27+
## Download Spring Boot project template
28+
29+
- Run following command in terminal to download a Spring Boot project template
30+
31+
```shell
32+
curl https://start.spring.io/starter.zip \
33+
-d artifactId=demo \
34+
-d bootVersion=3.4.5 \
35+
-d dependencies=configuration-processor,webflux,data-r2dbc,postgresql,data-redis-reactive,data-mongodb-reactive,validation,cache,testcontainers \
36+
-d javaVersion=21 \
37+
-d language=kotlin \
38+
-d packageName=com.example \
39+
-d packaging=jar \
40+
-d type=gradle-project-kotlin \
41+
-o starter.zip
42+
```
43+
44+
## Unzip the downloaded file
45+
46+
- Run following command in terminal to unzip the downloaded file
47+
48+
```shell
49+
unzip starter.zip -d .
50+
```
51+
52+
## Remove the downloaded zip file
53+
54+
- Run following command in terminal to delete the downloaded zip file
55+
56+
```shell
57+
rm -f starter.zip
58+
```
59+
60+
## Add additional dependencies
61+
62+
- Insert `springdoc-openapi-starter-webmvc-ui` and `archunit-junit5` dependency into `build.gradle.kts` file
63+
64+
```gradle.kts
65+
dependencies {
66+
implementation("org.springdoc:springdoc-openapi-starter-webflux-ui:2.8.6")
67+
testImplementation("com.tngtech.archunit:archunit-junit5:1.2.1")
68+
}
69+
```
70+
71+
- Insert SpringDoc configurations into `application.properties` file
72+
73+
```properties
74+
# SpringDoc configurations
75+
springdoc.swagger-ui.doc-expansion=none
76+
springdoc.swagger-ui.operations-sorter=alpha
77+
springdoc.swagger-ui.tags-sorter=alpha
78+
```
79+
80+
- Insert Redis configurations into `application.properties` file
81+
82+
```properties
83+
# Redis configurations
84+
spring.data.redis.host=localhost
85+
spring.data.redis.port=6379
86+
spring.data.redis.password=rootroot
87+
```
88+
89+
- Insert R2DBC configurations into `application.properties` file
90+
91+
```properties
92+
# R2DBC configurations
93+
spring.r2dbc.url=r2dbc:postgresql://localhost:5432/postgres
94+
spring.r2dbc.username=postgres
95+
spring.r2dbc.password=rootroot
96+
97+
spring.sql.init.mode=always
98+
spring.sql.init.platform=postgres
99+
spring.sql.init.continue-on-error=true
100+
```
101+
102+
- Insert MongoDB configurations into `application.properties` file
103+
104+
```properties
105+
# MongoDB configurations
106+
spring.data.mongodb.host=localhost
107+
spring.data.mongodb.port=27017
108+
spring.data.mongodb.authentication-database=admin
109+
spring.data.mongodb.username=root
110+
spring.data.mongodb.password=rootroot
111+
spring.data.mongodb.database=test
112+
```
113+
114+
- Create `docker-compose.yaml` at project root and add following services: `redis:6`, `postgresql:17` and `mongo:8`.
115+
116+
- redis service should have
117+
- password `rootroot`
118+
- mapping port 6379 to 6379
119+
- mounting volume `./redis_data` to `/data`
120+
- postgresql service should have
121+
- password `rootroot`
122+
- mapping port 5432 to 5432
123+
- mounting volume `./postgres_data` to `/var/lib/postgresql/data`
124+
- mongo service should have
125+
- initdb root username `root`
126+
- initdb root password `rootroot`
127+
- mapping port 27017 to 27017
128+
- mounting volume `./mongo_data` to `/data/db`
129+
130+
- Insert `redis_data`, `postgres_data` and `mongo_data` directories in `.gitignore` file
131+
132+
- Run gradle clean test command to check if the project is working
133+
134+
```shell
135+
./graldew clean test
136+
```
137+
138+
- (Optional) `docker-compose up -d` to start the services, `./graldew spring-boot:run` to run the Spring Boot project, `docker-compose rm -sf` to stop the services.
139+
140+
Let's do this step by step.

0 commit comments

Comments
 (0)