Currently the generated code includes areas for constructor and actions, which look basically like this:
...
class SomeService @Inject() (lifecycle: ApplicationLifecycle, config: ConfigurationProvider) extends SomeServiceBase {
// ----- Start of unmanaged code area for constructor SomeService
// ----- End of unmanaged code area for constructor SomeService
val someOperation = someOperationAction { input: (String, String) =>
val (someInput, someOther) = input
// ----- Start of unmanaged code area for action SomeService.someOperation
NotImplementedYet
// ----- End of unmanaged code area for action SomeService.someOperation
}
...
The idea here is adding support for DI so we can avoid using workarounds like getting injectors from the deprecated play.api.Play.current, creating object helpers to get the it from Guice.createInjector(SomeModule) or hardwiring dependencies directly.
Maybe it would be possible to implement in a way that we have the following header generated:
...
class SomeService @Inject() (
// ----- Start of unmanaged code area for dependencies to be injected in SomeService
// ----- End of unmanaged code area for dependencies to be injected SomeService
lifecycle: ApplicationLifecycle,
config: ConfigurationProvider
) extends SomeServiceBase {
...
P.S.: If we have this, I believe a natural step forward would be a way to define a "controller delegate" which would be a class to be automatically injected, to where calls would be automatically forwarded if a matching method is found, so forwarding managed code gets generated in those cases and we can get to a level that the developer only touches own yaml and scala sources, no need to add lines in generated code
Currently the generated code includes areas for constructor and actions, which look basically like this:
The idea here is adding support for DI so we can avoid using workarounds like getting injectors from the deprecated play.api.Play.current, creating object helpers to get the it from Guice.createInjector(SomeModule) or hardwiring dependencies directly.
Maybe it would be possible to implement in a way that we have the following header generated:
P.S.: If we have this, I believe a natural step forward would be a way to define a "controller delegate" which would be a class to be automatically injected, to where calls would be automatically forwarded if a matching method is found, so forwarding managed code gets generated in those cases and we can get to a level that the developer only touches own yaml and scala sources, no need to add lines in generated code