Skip to content

Pluggable Dependency Injection setup #25

Open

Description

@OlegDokuka

Actual Behaviour

At the moment, all generated server RSocket are marked with javax @Inject + @Named annotations which decrease the level of flexibility regarding using the library. From my experience, most of the injections are done through the explicit declaration of the configurations (e.g., Spring Boot configurations + beans) or modules in Dagger 2. First of all, such an aggressive injection decrease the flexibility in software testing because a usual classpath scanning will eagerly include all annotation's marked classes and inject them to test, so the user would have to hack framework for injecting mocks.

Expected Behavior

As a lib user, I want to have DI standards-free library, so I will be able to choose preferable DI solution, customize dependency injection in my application and keep it highly testable.

Proposal

As a compromise, I propose to have an additional flag for a protobuf plugin similar to what mapstruct has -> http://mapstruct.org/news/2018-07-15-mapstruct-1_3_0_Beta1-is-out-with-builder-support/#constructor-injection-for-annotation-based-component-models which make it possible to enable DI annotations on the generated classes.

With that addition, each user of RSocket-RPC-Java library will be able to turn on/off explicit dependency injection on demand

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions