跳到正文
Skillpedia
API 与服务器(后端)40k · #7145

create-spring-boot-kotlin-project

它能做什么

这个工具会为使用 Kotlin 和 Spring Boot 的编程项目创建基础结构。它会下载一个带有初始设置的项目模板,并添加一些实用的开发工具。

适用场景

  • ✓用 Kotlin 和 Spring Boot 开始一个新的 Web 项目时。
  • ✓需要一个应用的快速起步点时。
  • ✓想用 PostgreSQL、Redis 和 MongoDB 等数据库搭建项目时。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/create-spring-boot-kotlin-project/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/create-spring-boot-kotlin-project/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“创建一个名为“my-web-app”的 Kotlin Spring Boot 项目,使用默认设置。”

每周 5 个新技能,1 分钟读完。

工作原理

这个工具会从官方 Spring Initializr 网站下载针对 Kotlin 配置好的项目模板,然后添加数据库和其他工具所需的额外依赖与配置,让项目准备好供你开始编码。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Create Spring Boot Kotlin project prompt

Check Java version

  • Run following command in terminal and check the version of Java
java -version

Download Spring Boot project template

  • Run following command in terminal to download a Spring Boot project template
curl https://start.spring.io/starter.zip \
  -d artifactId=${input:projectName:demo-kotlin} \
  -d bootVersion=3.4.5 \
  -d dependencies=configuration-processor,webflux,data-r2dbc,postgresql,data-redis-reactive,data-mongodb-reactive,validation,cache,testcontainers \
  -d javaVersion=21 \
  -d language=kotlin \
  -d packageName=com.example \
  -d packaging=jar \
  -d type=gradle-project-kotlin \
  -o starter.zip

Unzip the downloaded file

  • Run following command in terminal to unzip the downloaded file
unzip starter.zip -d ./${input:projectName:demo-kotlin}

Remove the downloaded zip file

  • Run following command in terminal to delete the downloaded zip file
rm -f starter.zip

Unzip the downloaded file

  • Run following command in terminal to unzip the downloaded file
unzip starter.zip -d ./${input:projectName:demo-kotlin}

Add additional dependencies

  • Insert springdoc-openapi-starter-webmvc-ui and archunit-junit5 dependency into build.gradle.kts file
dependencies {
  implementation("org.springdoc:springdoc-openapi-starter-webflux-ui:2.8.6")
  testImplementation("com.tngtech.archunit:archunit-junit5:1.2.1")
}
  • Insert SpringDoc configurations into application.properties file
# SpringDoc configurations
springdoc.swagger-ui.doc-expansion=none
springdoc.swagger-ui.operations-sorter=alpha
springdoc.swagger-ui.tags-sorter=alpha
  • Insert Redis configurations into application.properties file
# Redis configurations
spring.data.redis.host=localhost
spring.data.redis.port=6379
spring.data.redis.password=rootroot
  • Insert R2DBC configurations into application.properties file
# R2DBC configurations
spring.r2dbc.url=r2dbc:postgresql://localhost:5432/postgres
spring.r2dbc.username=postgres
spring.r2dbc.password=rootroot

spring.sql.init.mode=always
spring.sql.init.platform=postgres
spring.sql.init.continue-on-error=true
  • Insert MongoDB configurations into application.properties file
# MongoDB configurations
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.authentication-database=admin
spring.data.mongodb.username=root
spring.data.mongodb.password=rootroot
spring.data.mongodb.database=test
  • Create docker-compose.yaml at project root and add following services: redis:6, postgresql:17 and mongo:8.

    • redis service should have
      • password rootroot
      • mapping port 6379 to 6379
      • mounting volume ./redis_data to /data
    • postgresql service should have
      • password rootroot
      • mapping port 5432 to 5432
      • mounting volume ./postgres_data to /var/lib/postgresql/data
    • mongo service should have
      • initdb root username root
      • initdb root password rootroot
      • mapping port 27017 to 27017
      • mounting volume ./mongo_data to /data/db
  • Insert redis_data, postgres_data and mongo_data directories in .gitignore file

  • Run gradle clean test command to check if the project is working

./gradlew clean test
  • (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.

Let's do this step by step.

常见问题

我需要事先安装什么软件吗?

需要。你的电脑上要安装 Java 21 和 Docker。

如何修改项目名称?

你可以在下载命令中编辑 `projectName` 参数来修改项目名称。

如何为项目添加更多工具?

你可以按照说明编辑 `build.gradle.kts` 文件和 `application.properties` 文件,来添加更多工具(称为“依赖”)。

详情

作者的原始描述

Create Spring Boot Kotlin Project Skeleton

repo: github/awesome-copilot

热度

GitHub 星标
40k
排名
#7145
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能