create-spring-boot-java-project

软件研发 后端与 API 1 文件 EN 原文

'Create Spring Boot Java Project Skeleton'

'Create Spring Boot Java Project Skeleton'

说明语言:英文

来源githubawesome-copilot ↗ 查看原文件 ↗版权归原作者,请遵循原仓库许可
安装
npx skills add https://github.com/github/awesome-copilot --skill create-spring-boot-java-project

需要已安装 skills CLI。也可以直接从源仓库 clone。

在星云中查看 ↗
SKILL.md 原文

name: create-spring-boot-java-project description: 'Create Spring Boot Java Project Skeleton' ---

Create Spring Boot Java project prompt

Check Java version

java -version

Download Spring Boot project template

curl https://start.spring.io/starter.zip \
  -d artifactId=${input:projectName:demo-java} \
  -d bootVersion=3.4.5 \
  -d dependencies=lombok,configuration-processor,web,data-jpa,postgresql,data-redis,data-mongodb,validation,cache,testcontainers \
  -d javaVersion=21 \
  -d packageName=com.example \
  -d packaging=jar \
  -d type=maven-project \
  -o starter.zip

Unzip the downloaded file

unzip starter.zip -d ./${input:projectName:demo-java}

Remove the downloaded zip file

rm -f starter.zip

Change directory to the project root

cd ${input:projectName:demo-java}

Add additional dependencies

<dependency>
  <groupId>org.springdoc</groupId>
  <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
  <version>2.8.6</version>
</dependency>
<dependency>
  <groupId>com.tngtech.archunit</groupId>
  <artifactId>archunit-junit5</artifactId>
  <version>1.2.1</version>
  <scope>test</scope>
</dependency>

Add SpringDoc, Redis, JPA and MongoDB configurations

# SpringDoc configurations
springdoc.swagger-ui.doc-expansion=none
springdoc.swagger-ui.operations-sorter=alpha
springdoc.swagger-ui.tags-sorter=alpha
# Redis configurations
spring.data.redis.host=localhost
spring.data.redis.port=6379
spring.data.redis.password=rootroot
# JPA configurations
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=rootroot
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
# 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

Add docker-compose.yaml with Redis, PostgreSQL and MongoDB services

Add .gitignore file

Run Maven test command

./mvnw clean test

Run Maven run command (Optional)

Let's do this step by step

同类技能
api-design-principlescopilot-sdkcreate-spring-boot-kotlin-projectdotnet-backend-patternsdotnet-best-practicesdotnet-timezonedotnet-upgradegolang-graphql
本页内容来自开源项目 github, 版权归原作者所有。
本站仅作技能索引与分享,所有 Skill 版权归其原作者所有。