Skip to content

Fix broken Kotlin examples in reference documentation #46064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dmitrysulman
Copy link
Contributor

There are multiple issues related to the Kotlin examples included in the Antora docs of the spring-boot-docs module.

  1. All Kotlin examples on the Development-time Services page are located in the wrong package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.devtools instead of org.springframework.boot.docs.features.devservices.testcontainers.atdevelopmenttime.devtools. As a result, none of the Kotlin examples from this page are picked up by Antora:
Screenshot 2025-06-20 at 20 14 55
  1. The MyContainers.kt example file is empty, unlike its Java counterpart:

    package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.importingcontainerdeclarations
    class MyContainers {
    }

  2. The Advanced Native Images Topics page contains an include-code::Nested[] block:

Reflection hints are automatically created for configuration properties by the Spring ahead-of-time engine.
Nested configuration properties which are not inner classes, however, *must* be annotated with javadoc:org.springframework.boot.context.properties.NestedConfigurationProperty[format=annotation], otherwise they won't be detected and will not be bindable.
include-code::MyProperties[]
where `Nested` is:
include-code::Nested[]

The Java version of the Nested class is used directly as an example. However, the Kotlin version of the same class was added in the Kotlin 2.1.0 migration PR only to make the code compile, as it is required by MyPropertiesKotlin.kt.

Since both classes share the same fully qualified name, Antora also picks up the Kotlin version and displays it on the page:

Screenshot 2025-06-20 at 18 41 36

This is what it looks like when the Kotlin version is shown:

Screenshot 2025-06-20 at 18 44 35

This PR fixes these issues by:

  • Moving all Kotlin examples from org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.devtools to org.springframework.boot.docs.features.devservices.testcontainers.atdevelopmenttime.devtools.
  • Moving the Nested.kt file to a nested subpackage to prevent it from being picked up by Antora.
  • Adding a proper Kotlin Testcontainers configuration example to the MyContainers.kt file.
  • Removing the SomeController.kt file, since it's unused (another SomeController.kt exists in the parent package and is the one actually referenced).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 20, 2025
@dmitrysulman dmitrysulman force-pushed the fix-kotlin-examples branch from cf660a6 to 8d859f0 Compare June 21, 2025 08:20
@snicoll snicoll changed the title Fix broken Kotlin examples in spring-boot-docs Antora documentation Fix broken Kotlin examples in reference documentation Jun 22, 2025
@snicoll snicoll added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 22, 2025
@snicoll snicoll added this to the 4.0.0-M1 milestone Jun 22, 2025
@snicoll snicoll self-assigned this Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants