Skip to content

Add SpringBootTransformer for merging Spring Boot configuration files#1936

Merged
Goooler merged 1 commit into
g/20260708/srping-boot-transformersfrom
copilot/add-new-transformer-for-1489
Jul 8, 2026
Merged

Add SpringBootTransformer for merging Spring Boot configuration files#1936
Goooler merged 1 commit into
g/20260708/srping-boot-transformersfrom
copilot/add-new-transformer-for-1489

Conversation

Copilot AI commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Spring Boot resource files (e.g., spring.factories, *.imports) are silently overwritten when multiple JARs are combined into a shadow JAR, breaking auto-configuration discovery. This adds a dedicated SpringBootTransformer that merges these files correctly.

Changes

  • New SpringBootTransformer extends PatternFilterableResourceTransformer (same pattern as ServiceFileTransformer) and handles the following resource files:
    • META-INF/spring.factories — comma-separated class lists; merged by appending values per key
    • META-INF/spring.handlers / spring.schemas / spring.tooling / spring-autoconfigure-metadata.properties — merged the same way
    • META-INF/spring/*.imports (Spring Boot 3+) — deduplicated line-per-class merge
  • Relocation-aware: dot-notation values (class names) use relocateClass; slash-notation values (resource paths, e.g. in spring.schemas) use relocatePath
  • @CacheableTransformer annotated; state tracked via @Internal maps
  • Default PatternSet covers all Spring Boot resource paths; users can customize includes/excludes via the inherited PatternFilterable API

Usage

tasks.shadowJar {
    transform(SpringBootTransformer::class.java)
    // optionally with relocation
    relocate("com.example", "shadow.example")
}
  • CHANGELOG's "Unreleased" section has been updated, if applicable.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add new transformer to handle #1489 Add SpringBootTransformer for merging Spring Boot configuration files Feb 27, 2026
@Goooler

Goooler commented Feb 27, 2026

Copy link
Copy Markdown
Member

@copilot Simplify this by PatternFilterableResourceTransformer

Copilot AI commented Feb 27, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Simplify this by PatternFilterableResourceTransformer

Done in 259d7d0. SpringBootTransformer now extends PatternFilterableResourceTransformer with a default PatternSet (like ServiceFileTransformer), removing the @Inject/ObjectFactory constructor, the canTransformResource() override, and the internal PROPERTIES_PATHS set.

@Goooler

Goooler commented Mar 1, 2026

Copy link
Copy Markdown
Member

It's so complex. I'll leave it closed for now.

@Goooler Goooler closed this Mar 1, 2026
@Goooler Goooler deleted the copilot/add-new-transformer-for-1489 branch March 1, 2026 10:35
@Goooler Goooler restored the copilot/add-new-transformer-for-1489 branch July 8, 2026 06:44
@Goooler Goooler reopened this Jul 8, 2026
@Goooler Goooler force-pushed the copilot/add-new-transformer-for-1489 branch from 2539b9d to 2dc5642 Compare July 8, 2026 06:46
@Goooler Goooler marked this pull request as ready for review July 8, 2026 07:37
@Goooler Goooler changed the base branch from main to g/20260708/srping-boot-transformers July 8, 2026 08:33
@Goooler Goooler merged commit 48846b4 into g/20260708/srping-boot-transformers Jul 8, 2026
1 of 6 checks passed
@Goooler Goooler deleted the copilot/add-new-transformer-for-1489 branch July 8, 2026 08:34
@Goooler

Goooler commented Jul 8, 2026

Copy link
Copy Markdown
Member

Merged into #2093.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants