Create Spring Boot Kotlin Project

Create Spring Boot Kotlin Project

Guides an agent to scaffold a Spring Boot Kotlin project from Spring Initializr with reactive web, R2DBC, Postgres, Redis, MongoDB and Testcontainers dependencies.

Skill files1 file
SKILL.md148 lines
1
---
2
name: create-spring-boot-kotlin-project
3
description: 'Create Spring Boot Kotlin Project Skeleton'
4
---
5
6
# Create Spring Boot Kotlin project prompt
7
8
- Please make sure you have the following software installed on your system:
9
10
- Java 21
11
- Docker
12
- Docker Compose
13
14
- If you need to custom the project name, please change the `artifactId` and the `packageName` in [download-spring-boot-project-template](#download-spring-boot-project-template)
15
16
- If you need to update the Spring Boot version, please change the `bootVersion` in [download-spring-boot-project-template](#download-spring-boot-project-template)
17
18
## Check Java version
19
20
- Run following command in terminal and check the version of Java
21
22
```shell
23
java -version
24
```
25
26
## Download Spring Boot project template
27
28
- Run following command in terminal to download a Spring Boot project template
29
30
```shell
31
curl https://start.spring.io/starter.zip \
32
-d artifactId=${input:projectName:demo-kotlin} \
33
-d bootVersion=3.4.5 \
34
-d dependencies=configuration-processor,webflux,data-r2dbc,postgresql,data-redis-reactive,data-mongodb-reactive,validation,cache,testcontainers \
35
-d javaVersion=21 \
36
-d language=kotlin \
37
-d packageName=com.example \
38
-d packaging=jar \
39
-d type=gradle-project-kotlin \
40
-o starter.zip
41
```
42
43
## Unzip the downloaded file
44
45
- Run following command in terminal to unzip the downloaded file
46
47
```shell
48
unzip starter.zip -d ./${input:projectName:demo-kotlin}
49
```
50
51
## Remove the downloaded zip file
52
53
- Run following command in terminal to delete the downloaded zip file
54
55
```shell
56
rm -f starter.zip
57
```
58
59
## Unzip the downloaded file
60
61
- Run following command in terminal to unzip the downloaded file
62
63
```shell
64
unzip starter.zip -d ./${input:projectName:demo-kotlin}
65
```
66
67
## Add additional dependencies
68
69
- Insert `springdoc-openapi-starter-webmvc-ui` and `archunit-junit5` dependency into `build.gradle.kts` file
70
71
```gradle.kts
72
dependencies {
73
implementation("org.springdoc:springdoc-openapi-starter-webflux-ui:2.8.6")
74
testImplementation("com.tngtech.archunit:archunit-junit5:1.2.1")
75
}
76
```
77
78
- Insert SpringDoc configurations into `application.properties` file
79
80
```properties
81
# SpringDoc configurations
82
springdoc.swagger-ui.doc-expansion=none
83
springdoc.swagger-ui.operations-sorter=alpha
84
springdoc.swagger-ui.tags-sorter=alpha
85
```
86
87
- Insert Redis configurations into `application.properties` file
88
89
```properties
90
# Redis configurations
91
spring.data.redis.host=localhost
92
spring.data.redis.port=6379
93
spring.data.redis.password=rootroot
94
```
95
96
- Insert R2DBC configurations into `application.properties` file
97
98
```properties
99
# R2DBC configurations
100
spring.r2dbc.url=r2dbc:postgresql://localhost:5432/postgres
101
spring.r2dbc.username=postgres
102
spring.r2dbc.password=rootroot
103
104
spring.sql.init.mode=always
105
spring.sql.init.platform=postgres
106
spring.sql.init.continue-on-error=true
107
```
108
109
- Insert MongoDB configurations into `application.properties` file
110
111
```properties
112
# MongoDB configurations
113
spring.data.mongodb.host=localhost
114
spring.data.mongodb.port=27017
115
spring.data.mongodb.authentication-database=admin
116
spring.data.mongodb.username=root
117
spring.data.mongodb.password=rootroot
118
spring.data.mongodb.database=test
119
```
120
121
- Create `docker-compose.yaml` at project root and add following services: `redis:6`, `postgresql:17` and `mongo:8`.
122
123
- redis service should have
124
- password `rootroot`
125
- mapping port 6379 to 6379
126
- mounting volume `./redis_data` to `/data`
127
- postgresql service should have
128
- password `rootroot`
129
- mapping port 5432 to 5432
130
- mounting volume `./postgres_data` to `/var/lib/postgresql/data`
131
- mongo service should have
132
- initdb root username `root`
133
- initdb root password `rootroot`
134
- mapping port 27017 to 27017
135
- mounting volume `./mongo_data` to `/data/db`
136
137
- Insert `redis_data`, `postgres_data` and `mongo_data` directories in `.gitignore` file
138
139
- Run gradle clean test command to check if the project is working
140
141
```shell
142
./gradlew clean test
143
```
144
145
- (Optional) `docker-compose up -d` to start the services, `./gradlew spring-boot:run` to run the Spring Boot project, `docker-compose rm -sf` to stop the services.
146
147
Let's do this step by step.
148

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…