Skip to content

Add @Component + constructor-injection example and Beans facade#7

Open
iliyan-velichkov wants to merge 1 commit into
masterfrom
feat/spring-style-components
Open

Add @Component + constructor-injection example and Beans facade#7
iliyan-velichkov wants to merge 1 commit into
masterfrom
feat/spring-style-components

Conversation

@iliyan-velichkov

Copy link
Copy Markdown
Collaborator

Adds Spring-style dependency-injection examples to the sample project, demonstrating capabilities enabled by eclipse-dirigible/dirigible#6051.

What's added

  • demo/GreetingService.java — a plain @Component service.
  • demo/GreetingController.java — a controller that receives GreetingService via constructor injection (the preferred, testable style), and a second route showing the Beans facade (Beans.get(GreetingService.class)) for programmatic lookup when an injection point isn't convenient.
  • README — documents the three DI styles: field injection (existing CountryController, left untouched), constructor injection, and programmatic lookup.

Dependency

This depends on eclipse-dirigible/dirigible#6051, which introduces the @Component annotation, constructor injection for controllers, and the Beans facade in the client-Java SDK. CI will fail until #6051 merges — this PR must merge after it.

🤖 Generated with Claude Code

Demonstrates the Spring-style DI now supported by the client-Java model:
a plain @component service (GreetingService) injected into a controller
(GreetingController) by constructor, plus the Beans facade for programmatic
lookup. Existing CountryController is left untouched as the field-injection
example. README documents the three styles.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant