Index of every page on this site: llms.txt
All skills
github avatar

/java-springboot

@f10fdb8 official
by githubgithub/awesome-copilot42k stars
5,426
Run it yourself

Write and review application code in an existing Spring Boot 3/4 project: controllers, validation and ProblemDetail errors, Spring Data JPA/JDBC, RestClient and HTTP interfaces, configuration properties, Kafka/AMQP, caching, scheduling, virtual threads, AOT and startup tuning. Use when adding or changing features. To scaffold a new project use create-spring-boot-java-project instead.

Use this Skill: https://skilld.dev/gh/github/awesome-copilot/java-springboot

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesconfiguration.md

≈1.3k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Configuration

Formats, profiles, .env and secret basics, and the short @ConfigurationProperties example already live in create-spring-boot-java-project (references/configuration.md); read it for those and keep one format (properties or YAML) as the project already does. This file adds what is needed when changing an existing application. Verified on Boot 4.1.1.

Type-safe properties (records)

@ConfigurationProperties(prefix = "app.mail")
@Validated
public record MailProperties(@NotBlank String from, @DefaultValue("3") @Positive int retries,
		@DefaultValue("5s") Duration timeout) {}
app.mail.from=noreply@example.com
  • Records bind through their canonical constructor (constructor binding is the default for records). Use @DefaultValue (org.springframework.boot.context.properties.bind.DefaultValue) for optional values; Duration, DataSize, enums and List/Map bind natively (5s, PT5S, 10MB).
  • Register with @ConfigurationPropertiesScan on the application class (or @EnableConfigurationProperties(MailProperties.class)). Verified: the record is a bean with retries == 3 and timeout == 5s when only from is set.
  • @Validated + jakarta.validation constraints make the application fail at startup on invalid configuration, which is what you want. Validation needs the validation starter (spring-boot-starter-validation).
  • Prefer @ConfigurationProperties to scattered @Value; use @Value only for one-off values. Add spring-boot-configuration-processor (optional/annotation-processor path, as start.spring.io does) for IDE metadata.
  • Immutability: no setters; nested config as nested records.
  • Inject the record where needed; do not read Environment directly in business code.

Profiles

  • Keep production-safe defaults in application.properties; profile files (application-dev.properties) only override what differs. Activate with SPRING_PROFILES_ACTIVE.
  • Group related profiles with spring.profiles.group.prod=prod-db,prod-observability when a deployment needs several.
  • Use @Profile sparingly for beans; do not branch application logic on profile names.
  • Do not ship a test profile in src/main; tests use src/test/resources or @TestPropertySource (see spring-boot-testing).

Config import and secrets

spring.config.import=optional:file:.env[.properties],optional:configtree:/run/secrets/
  • optional: prevents startup failure when the file is absent (local development); drop it for values that must exist in production.
  • Kubernetes/Docker secrets mounted as files: configtree: maps each file to a property (file name = key).
  • Environment variables override files through relaxed binding (APP_MAIL_FROM -> app.mail.from).
  • Never commit .env or real credentials; commit .env.sample. Do not log property values holding secrets, and do not expose /actuator/env and /actuator/configprops publicly (spring-observability, spring-security).
  • Externalized config sources like Vault or Spring Cloud Config are out of scope unless the project already uses them; follow its existing import setup.

Dev-time services

Docker Compose

Add spring-boot-docker-compose (start.spring.io adds it, optional/development-only). With a compose.yaml at the project root, ./mvnw spring-boot:run starts the services and wires connection details automatically. Pin image tags (start.spring.io generates postgres:latest; replace it, see create-spring-boot-java-project references/database.md). Not executed in this skill's verification: only the generated files were inspected.

Testcontainers at dev time

start.spring.io (with the testcontainers dependency) generates TestcontainersConfiguration and a TestDemoApplication in src/test:

public class TestDemoApplication {
	public static void main(String[] args) {
		SpringApplication.from(DemoApplication::main).with(TestcontainersConfiguration.class).run(args);
	}
}

Run it with ./mvnw spring-boot:test-run (Gradle: ./gradlew bootTestRun). Verified on Boot 4.1.1: PostgreSQL and Kafka containers started from the @ServiceConnection beans, the app reached UP on /actuator/health, and stopping the app removed the containers (Ryuk). Make TestcontainersConfiguration public if it is used from other packages (see create-spring-boot-java-project references/spring-boot-4.md). Choose either Compose or Testcontainers for dev-time services, not both, to avoid two databases fighting over the same properties.

Boot 3 vs 4

Same property binding rules. Boot 4 changes that touch configuration: Jackson properties continue under spring.jackson.* for Jackson 3 (Jackson 2 compatibility lives in a separate module; consult the migration guide), modular auto-configuration (classes moved to org.springframework.boot.<technology>.autoconfigure, which matters only if you reference or exclude auto-configurations by class name: spring.autoconfigure.exclude=org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration). Use the spring-boot-4-migration skill for the move itself.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning5d5 checks · Risk SAFE
  • Gen Agent Trust Hub12d

    The skill provides safe and idiomatic guidance for Spring Boot 3 and 4 development. It incorporates several security best practices, such as proper secret management (advising against committing credentials), input validation, and secure API design. A minor risk factor is present as the agent is instructed to read external project build and configuration files, which could theoretically contain malicious instructions designed to influence the agent.

  • Socket5d

    No alerts

  • Snyk12d

    Risk: LOW · No issues

  • Runlayer9mo

    1/1 file flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at f10fdb8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated last month
  • Testing
  • java
  • spring-boot
  • rest-api
  • jpa
  • spring-security
  • configuration
  • dependency-injection

README badge

README badge for github/awesome-copilot/java-springboot

Instructs Claude to follow Spring Boot best practices for Java applications, covering project structure, dependency injection, configuration management, REST API design, data access patterns, testing, and security. Targets developers building Spring Boot applications with Maven or Gradle and using Spring Data JPA for persistence.

Generated from the current SKILL.md.

Does this skill cover Spring Security configuration?
Yes. It includes guidance on using Spring Security for authentication and authorization, password encoding with BCrypt, and preventing SQL injection and XSS attacks.
What testing frameworks does this skill recommend?
JUnit 5 and Mockito for unit tests, @SpringBootTest for integration tests, test slice annotations like @WebMvcTest and @DataJpaTest for isolated testing, and Testcontainers for reliable database and external service testing.
Does this skill cover data layer patterns?
Yes. It covers Spring Data JPA repositories, custom queries with @Query, the JPA Criteria API, and DTO projections for efficient data fetching.
What configuration approach does this skill recommend?
Use externalized configuration via application.yml, @ConfigurationProperties for type-safe binding, Spring Profiles for environment-specific configs, and environment variables or secret management tools like Vault or AWS Secrets Manager for secrets.
Does this skill address error handling?
Yes. It recommends implementing a global exception handler using @ControllerAdvice and @ExceptionHandler for consistent error responses across the application.

Generated from the current SKILL.md. These answers refresh after source changes.