Unclear on the use the `jx` module
See original GitHub issueI am have bound services needing other bound services.
My binding looks like this:
val kodein = Kodein {
import(jxInjectorModule)
bind<Properties>() with singleton { PropertiesLoaderUtils.loadProperties(ClassPathResource("application.properties")) }
bind<FileContentProvider>() with singleton { FileContentProvider.default }
bind<DistributionService>() with singleton { jx.newInstance<DistributionServiceImpl>() }
bind<InnkeeperClient>() with singleton { jx.newInstance<InnkeeperClientImpl>() }
bind<QuiltClient>() with singleton { jx.newInstance<QuiltClientImpl>() }
bind<TessellateClient>() with singleton { jx.newInstance<TessellateClientImpl>() }
bind<JsonService>() with singleton { JsonServiceImpl() }
bind<RequestContext>() with singleton { RequestContextImpl() }
bind<Authorization>() with singleton { AuthorizationImpl() }
}
The moment I hit the resolving of the DistributionService
, it fails with this message:
com.github.salomonbrys.kodein.Kodein$DependencyLoopException: Dependency recursion:
╔═> bind<JxInjector>()
╠─> bind<DistributionService>()
╚═> bind<JxInjector>()
The constructor of my DistributionServiceImpl
is:
class DistributionServiceImpl(
private val jsonService: JsonService,
private val properties: Properties,
private val quiltClient: QuiltClient,
private val innkeeperClient: InnkeeperClient,
private val tessellateClient: TessellateClient
) : DistributionService {
When I debug with breakpoints in every one of the singleton
lambda, I observe that the following are called:
JsonServiceImpl()
FileContentProvider.default
jx.newInstance<DistributionServiceImpl>()
Then it fails before entering the constructor of classDistributionServiceImpl
.
I feel that I simply am not using this right. However, the documentation does not state a clear example of how to declare a binding block using the jx
approach. It just states as an example:
val kodein = Kodein {
import(jxInjectorModule)
/* Other bindings */
}
I am interested in HOW to declare the other bindings here.
Thanks for whatever help you can provide.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
JXCore packaging, NPM errors - node.js
I dont think,the problem is with NPM, step by step compile each of the .js file, and introduce required NPM package one by...
Read more >Using custom SQLite Library Ubuntu fails · Issue #798
Hi, I am using custom SQLite library based on see I am trying to get JXCore to work with it following issue ......
Read more >Prokaryote toxin–antitoxin modules: Complex regulation of an ...
Toxin–antitoxin (TA) modules are small operons in bacteria and archaea that encode a metabolic inhibitor (toxin) and a matching regulatory ...
Read more >kumarvna/postgresql-db/azurerm
This module utilizes postgresadmin as a local administrator on PostgreSQL server. If you want to you use custom username, then specify the ...
Read more >UPDATE 1-Japan's JX shuts vacuum distillation unit after fire
The fire started at 11:23 a.m. (0223 GMT) on Sunday and was extinguished by 6:57 p.m. (0957 GMT) the same day, the company...
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
Certainly looks correct…
Hi there, this really looks like a bug 😦 I;ll have a look as soon as I can