Comments (6)
The problem with Jersey is that it itself implements JSR330 (through HK2), so you'd have to create a bridge between HK2 and Dagger2, and that doesn't work well because of the opposite design choices of those two libraries (you could possibly use tbroyer/bullet but that wouldn't solve the issue with scopes and having to deal with several components).
Resteasy would be OK though, using a component-per-resource approach (akin to the component-per-activity approach in Android development), and similarly for servlets.
The issue with JAX-RS is that of scopes: you cannot reliably make a per-request scope with JAX-RS spanning filters and resources, unless you resort to hacks (such as passing your component as a header (sic!)), or rely on being deployed in a servlet environment (where you can use HttpRequest
attributes)
from dagger.
Does this mean then we are stuck with guice then? I was delaying with upgrading to jersey2 hoping we could switch directly to dagger. But it seems this ain't gonna happen soon.
Thankfully there seems to be finally a good bridge between jersey2 and guice.
https://github.com/Squarespace/jersey2-guice
I imagine a lot of people who use Jersey and Guice have the similar dilemma.
Thanks
from dagger.
I imagine a lot of people who use Jersey and Guice have the similar dilemma.
o/
As a Jersey1 user, I was happy to have the freedom of choosing my preferred DI framework.
Jersey2 has applied an unpleasant strategy to tie its use to H2K. The bridge approach doesn't please me because it forces us to overload the software with two DI frameworks, when one is just enough. I ended moving to Resteasy.
from dagger.
To change to Resteasy just because of DI is bit too much and is not a practical solution for us.
I understand that the problem is rather on Jersey side.
Still would be nice to find an answer. The best solution would be for Jersey team reconsider its DI philisophy (which is very anti JAVA way btw). But since they haven't done it for Guice, I guess they wouldn't do it here. 😞
from dagger.
Our focus has been on Android and core functionality. That said, we want more examples, and would take contributions, provisionally. Ultimately we have plans for more robust integrations, but not in a 2.0 timeline.
from dagger.
We'd gladly accept contributions with more examples (preferably from people that have experience with these frameworks since we don't)!
from dagger.
Related Issues (20)
- SecurityException when trying to run UI test with hilt and Jetpack Compose on Android 14 HOT 3
- BadParcelableException in Activity onCreate HOT 3
- Dagger 2.50 KSP fails to generate field in implementation for a @Named field HOT 2
- Conflicting documentation for dagger.android and Hilt optional inject HOT 3
- [KSP] dagger-android hanging indefinitely on a large multi module project HOT 2
- Optional bindings in a parent component can sometimes use bindings from child components HOT 2
- NullPointerException dagger.spi.shaded.androidx.room.compiler.processing.XTypeElement.getAnnotation HOT 6
- Problem with Injection of DAO HOT 1
- error: [Hilt] Could not get element for com.foo.viewModels.FooViewModel_HiltModules.BindsModule: java.lang.NullPointerException HOT 1
- Missing release notes for 2.51 HOT 1
- `LazyClassKey` doesn't work when providing a `Map<Class<*>, Provider<?>` with a scope
- @AssistedInject in ViewModel using Dagger (NOT Hilt, just dagger) does not compile: cannot be provided without an @Inject constructor or an @Provides-annotated method HOT 6
- [issue] Dagger doesn't compile or doesn't give a right error message when ViewModelFactory is implemened on Kotlin rather than on Java HOT 4
- Having an issue with Dagger Hilt Proguard Rules HOT 12
- Following dagger.dev tutorial doesnt create singleton in v2.51 HOT 2
- Multibinding with Nested Complex Keys uses the wrong AnnotationCreator HOT 1
- [Hilt] onCreate() in my Application doesn't called on Instrument test HOT 4
- [Dagger-Hilt] Error when applying obfuscation other than Proguard (Allatori) HOT 3
- error: [Hilt] Expected @AndroidEntryPoint to have a value HOT 3
- Cause: couldn't make a guess for com.openvpn.Vpn.databinding.FragmentMainBindingImpl HOT 6
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 dagger.