Skip to content

Controllers implementing interfaces not mapped when the observability module is used #933

@anguzo

Description

@anguzo

Description

When using Interface-Driven Controllers in a Spring project configured with spring-web, spring-modulith, and spring-boot-actuator, the controllers do not function as expected. The issue appears specifically when including spring-modulith-observability as a runtime dependency.

For example, the following setup fails to work:

@RestController
class HelloController : HelloResource {
    override fun hello(testText: String): String {
        return testText
    }
}

interface HelloResource {
    @GetMapping("/api/hello")
    fun hello(@RequestParam("testText") testText: String): String
}

Reproducing the Issue

Here is a minimal sample to reproduce the issue:
demo.zip

When adding runtimeOnly("org.springframework.modulith:spring-modulith-observability") in the Gradle configuration, Interface-Driven Controllers fail to function. Removing this dependency allows the controllers to work as expected.

Expected Behavior

The application should process requests to the /api/hello endpoint and return the provided testText parameter as expected.

Observed Behavior

When spring-modulith-observability is included as a dependency, the endpoint does not work.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions