Token导航 LogoToken导航TokenDH.com
运维和基础设施可写文件github未标认证来源可访问许可证需确认审计通过

gradle-spring-boot-integrationgradle spring boot 集成

Agent Skill

用于辅助 Java 项目开发、面向对象设计、Spring 生态、Maven 或 Gradle 依赖和后端工程实践。它适合让 Agent 分析类结构、设计接口、整理服务分层、生成测试或检查常见代码坏味道。使用时需要结合项目已有架构、包结构和依赖版本,不应只按通用教程改代码;涉及数据库、事务、并发或框架配置时,应先确认运行环境和回归测试范围。

总安装

214

周安装

9

GitHub Stars

1

下载量

75
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gradle-spring-boot-integration(gradle spring boot 集成)
来源仓库:https://github.com/dawiddutoit/custom-claude
仓库路径:skills/gradle-spring-boot-integration
安装命令:
npx skills add https://github.com/dawiddutoit/custom-claude --skill gradle-spring-boot-integration
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dawiddutoit/custom-claude --skill gradle-spring-boot-integration

简介

协助 Spring Boot 项目与 Gradle 的深度集成与配置校验。

  • 适用于新 starter 开发或现有工程向 Spring Native 迁移。
  • 可自动生成启动类、配置类及测试桩代码结构。
  • 要求项目已引入 spring-boot-gradle-plugin 并定义主类。
  • 注意:涉及 AOT 编译时需额外关注反射与资源加载限制。

SKILL.md

Works with build.gradle.kts, application.yml, and Dockerfile configurations.

Gradle Spring Boot Integration

Table of Contents

Purpose

Set up and configure Spring Boot projects in Gradle with proper JAR creation, Docker optimization, and multi-module support. This skill covers bootable JAR setup, layered JARs for optimal Docker caching, and Spring Boot-specific task configuration.

When to Use

Use this skill when you need to:

  • Set up new Spring Boot projects with Gradle
  • Create executable JAR files for Spring Boot applications
  • Configure layered JARs for optimized Docker builds
  • Set up multi-module projects with shared libraries
  • Configure Spring Boot DevTools for hot reload
  • Inject build information into application.yml
  • Set up Spring Boot Actuator for monitoring
  • Configure testing with Spring Boot test starters

Quick Start

Minimal Spring Boot setup in build.gradle.kts:

plugins {
    id("java")
    id("org.springframework.boot") version "3.5.5"
    id("io.spring.dependency-management") version "1.1.7"
}

group = "com.example"
version = "0.0.1-SNAPSHOT"

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-web")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
}

tasks.test {
    useJUnitPlatform()
}

Run and build:

./gradlew bootRun                                    # Run locally
./gradlew bootJar                                    # Create executable JAR
./gradlew bootRun --args='--spring.profiles.active=dev'  # Run with profile

Instructions

Step 1: Apply Spring Boot Plugin

Configure the Spring Boot Gradle plugin for your project type:

// build.gradle.kts - Web Service (creates bootable JAR)
plugins {
    id("java")
    id("org.springframework.boot") version "3.5.5"
    id("io.spring.dependency-management") version "1.1.7"
}

Key plugins:

  • org.springframework.boot: Creates executable JARs, provides bootRun task
  • io.spring.dependency-management: Automatically imports Spring Boot BOM

Step 2: Configure Java Toolchain

Specify Java version for consistency:

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

Step 3: Add Spring Boot Dependencies

Use the BOM automatically imported by the plugin:

dependencies {
    // Spring Boot starter (no version needed - from BOM)
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("org.springframework.boot:spring-boot-starter-data-jpa")

    // Development only (DevTools for hot reload)
    developmentOnly("org.springframework.boot:spring-boot-devtools")

    // Test dependencies
    testImplementation("org.springframework.boot:spring-boot-starter-test")
}

// Enable JUnit 5
tasks.test {
    useJUnitPlatform()
}

Step 4: Configure Bootable JAR Creation

For services (executable JARs):

tasks.bootJar {
    enabled = true
    archiveClassifier = ""  // No classifier for main artifact
}

tasks.jar {
    enabled = false  // Disable plain JAR
}

For libraries (plain JARs):

tasks.bootJar {
    enabled = false  // Not executable
}

tasks.jar {
    enabled = true  // Create library JAR
}

Step 5: Enable Layered JARs for Docker Optimization

Layered JARs separate dependencies by change frequency for better Docker caching:

tasks.bootJar {
    enabled = true

    layered {
        enabled = true
        application {
            enabled = true
        }
        dependencies {
            enabled = true
        }
        springBootLoader {
            enabled = true
        }
        snapshot {
            enabled = true
        }
    }
}

Layers (in order):

  1. dependencies: Rarely-changing external dependencies
  2. spring-boot-loader: Spring Boot loader classes
  3. snapshot-dependencies: Snapshot/SNAPSHOT versions (changing)
  4. application: Application classes (most frequently changing)

Extract layers in Dockerfile:

FROM eclipse-temurin:21-jre-alpine AS builder
WORKDIR /builder
COPY build/libs/app.jar .
RUN java -Djarmode=layertools -jar app.jar extract

FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
COPY --from=builder /builder/dependencies ./
COPY --from=builder /builder/spring-boot-loader ./
COPY --from=builder /builder/snapshot-dependencies ./
COPY --from=builder /builder/application ./
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]

Step 6: Configure Application Properties

Inject build information into application.yml:

tasks.processResources {
    filesMatching("application.yml") {
        expand(
            "version" to project.version,
            "name" to project.name,
            "timestamp" to System.currentTimeMillis()
        )
    }
}

In application.yml:

spring:
  application:
    name: ${name}

info:
  app:
    name: ${name}
    version: ${version}
    build-timestamp: ${timestamp}

Step 7: Set Up Spring Boot DevTools for Local Development

Enable hot reload during development:

dependencies {
    developmentOnly("org.springframework.boot:spring-boot-devtools")
}

Trigger reload:

  • IntelliJ: Build Project (Cmd/Ctrl + F9)
  • Eclipse: Save file
  • CLI: Run ./gradlew compileJava in separate terminal

Step 8: Configure Actuator for Monitoring

Add actuator endpoints and metrics:

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("io.micrometer:micrometer-registry-prometheus")
}

In application.yml:

management:
  endpoints:
    web:
      exposure:
        include: health,info,prometheus,metrics,env
  metrics:
    export:
      prometheus:
        enabled: true
  endpoint:
    health:
      show-details: always

Examples

Example 1: Simple Web Service

// build.gradle.kts
plugins {
    id("java")
    id("org.springframework.boot") version "3.5.5"
    id("io.spring.dependency-management") version "1.1.7"
}

group = "com.waitrose"
version = "1.0.0"

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("org.springframework.boot:spring-boot-starter-actuator")

    testImplementation("org.springframework.boot:spring-boot-starter-test")
}

tasks.test {
    useJUnitPlatform()
}

tasks.bootJar {
    enabled = true
}

tasks.jar {
    enabled = false
}

Build and run:

./gradlew bootJar              # Create JAR: build/libs/app-1.0.0.jar
java -jar build/libs/app-1.0.0.jar  # Run JAR

For advanced examples including multi-module setups, layered JARs with Docker, build info injection, and testing configurations, see examples/advanced-examples.md.

Commands Reference

See references/commands-and-troubleshooting.md for complete command reference and troubleshooting guide.

See Also

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.81%
按下载量换算28

Claude

29.41%
按下载量换算22

Cursor

19.16%
按下载量换算14

Gemini CLI

9.61%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

可写文件

该 Skill 可能写入或修改本地文件,使用前需要确认目标目录和修改范围。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills