5 ms·
> Android, JavaEE, web servlet containers, DI frameworks, etc... Most of which support constructor injection.
by snuxoll 10y ago
> Android, JavaEE, web servlet containers, DI frameworks, etc...
Most of which support constructor injection.
- hota_mazi 10y agoEr... none of them except maybe Guice? They all require a parameterless constructor so they can instantiate your objects before reflecting them.
- mejari 10y agoExactly. I spent some time testing out converting a small part of our large codebase that uses Spring to Kotlin and was able to easily switch over to constructor injection. I think it actually made the injection cleaner. It was nicer for my tests too, instead of @Mock/@InjectMocks magic.