KTP draft specs
See original GitHub issueKotlin Toothpick draft specs - WIP
Use delegate properties for field injection
We should not use annotations for field injection, instead we will use delegate properties. For example:
by ktp.inject() // default scope
by ktp.lazy() // lazy
by ktp.provider() // provider
Moreover, there should be a way to:
- Specify when to use the default scope and when to wait for a scope to be provided.
- Use a named injection.
Kotlin friendly API for
- Module and bindings definition (https://github.com/sporttotal-tv/toothpick-kotlin-extensions and https://github.com/stephanenicolas/toothpick/issues/305)
- Scope creation and “scope binding”.
- Configuration of injectable classes
- Should we use the
@Inject
annotation? and where? - How to define the constructor to use
- How to define a singleton
- How to define in what scope an instance will be created
- Should we use the
Generate code compatible with optional parameters (possible?)
WIP
Moreover, KTP will be based on TP 2.0 -> no registries (no configuration needed), incremental annotation processing, better scope annotations, … (https://github.com/stephanenicolas/toothpick/issues/315, https://github.com/stephanenicolas/toothpick/issues/225)
Something you miss? Any suggestion? Please comment 🙂
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Project 885 Yasen / Graney Severodvinsk class
Length (on design waterline), 134-139 m / 435-452 feet, 127-130 m / 413-423 feet ; beam of the hull, 13 m 12-15 meters,...
Read more >HEADQUARTERS! - Kittery Trading Post
KTP $39.99-$79.99 SALE $24.99-$39.99 photo courtesy of Columbia Sportswear ... Medium-weight with fleece liner. Black, grey or ... 36”- 40” DRAFT STOPPERS.
Read more >Animal Products Notice: Specifications for Laboratories
The Animal Products (Recognised Laboratories and Persons Specifications for ... Key Technical Person (KTP) means a laboratory person formally appointed or ...
Read more >Knowledge Transfer Partnerships (KTP) - Dalarna University
KTP is a project that secures positions for recent graduates in regional companies where they remain for up to two years working in...
Read more >KTP Associate Recruitment Process - StudyLib
Recruitment and Retention of KTP Associates A Guide to Good Practice 1 of 55 Contents ... When you have drafted your job specification...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think constructor injection is the preferred way for dependency injection on kotlin too. It’s explicit. You don’t have to run your tests to know you forgot dependencies when refactoring.
@dimsuz constructor injections are indeed preferred in Java DI frameworks, and also when we’re talking about DI in general most of us think about JSR330. Not sure this applies to Kotlin though. I believe we should use the community brainpower to figure out something that’s more suited for Kotlin and what this language has to offer, rather than limiting ourselves to what DI meant for Java.
A DI framework is supposed to make dependency injection easy. KTP could be just that tailored specifically for Kotlin.
Also I think if you like how Toothpick for java works, I believe you could still use it in Kotlin it would just be a bit different (maybe more verbose) and you would depend on a Java module.