Comments (5)
Hi clojj,
I appreciate the suggestions and I agree with you. The application-core was meant to be agnostic of technical decisions so having the dependency on Spring with @service was an oversight! Great catch.
Another option is to remove the spring dependency in application-core module and use the javax.inject annotations instead. Replace @service with @nAmed so the application-core remains technology agnostic, but still maintains compatibility with Spring's DI. I tried this and all the tests continue to function as normal. I'm still thinking about which is the right choice, this option or what you mentioned. Your thoughts?
Using the onionArchitecture() would be cleaner.
Please submit a PR in the meantime and we can both think about the above question.
Cheers,
Dustin
from hex-arch-kotlin-spring-boot.
ok, I did not even think about CDI annotations!
These still would depend on frameworks implementing them, but it would be an improvement, yes.
For me, Kotlin beans DSL is a nice modern approach.
In this scenario, it works fine by just passing the service type as generic type. The service needs a repository, which in turn can use spring annotations. No problem there.
There may be different scenarios though, which may require different approaches.
from hex-arch-kotlin-spring-boot.
Pushed the small change to remove Spring from application-core.
I'm interested in your suggestions, submit a PR and I'll take a look at what you have in mind.
from hex-arch-kotlin-spring-boot.
I just realized that the Quarkus module depends on CDI.
Think I have to ponder about these domain services some more, and how they relate to these surrounding frameworks (which usually make heavy use of DI)
And, if it is functions + data all the way (think Ktor), DI may not even be an issue at all.
from hex-arch-kotlin-spring-boot.
Ktor and Kotless are all great and valid frameworks to use too. I come from a background with a heavy investment in Spring so I like to show where possible where other frameworks can interoperate with Spring. Quarkus for example.
If greenfield with Kotlin is possible, agree Ktor, Kotless, Micronaut, Quarkus are all great options which don't need Spring.
from hex-arch-kotlin-spring-boot.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hex-arch-kotlin-spring-boot.