Guice
Weld
Our great sponsors
Guice | Weld | |
---|---|---|
31 | 4 | |
12,343 | 374 | |
0.3% | 0.3% | |
7.5 | 8.9 | |
11 days ago | 6 days ago | |
Java | Java | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Guice
-
Hexagonal Architecture/Ports And Adapters: Clarifying Key Concepts Using Go
Historically, Ports and Adapters was born in the context where Dependency Inversion Principle (DIP) was getting hot, back in the beginning of the 2000’s. DIP was getting more present on development day to day, and an example of a framework that was a pioneer in such topic is Google Guice.
-
Inversion of Control Containers and the Dependency Injection Pattern (2004)
“There are many advantages to using dependency injection, but doing so manually often leads to a large amount of boilerplate code to be written. Guice is a framework that makes it possible to write code that uses dependency injection without the hassle of writing much of that boilerplate code”
This is a common misconception. Guice’s docs delineate between dependency injection as a pattern and Guice as a framework that supports that pattern.
https://github.com/google/guice/wiki
- How to dependency injection
-
Why dependency injection?
You can (and it's very normal to) use that with new. Dependency injection frameworks (like guice) let you skip passing long parameter lists to constructor arguments like you mention. But you don't really NEED that. They also will solve circular dependency issues and some other things, although a strong argument could be made that you should simply restructure your code so that those issues don't exist.
-
Bob Lee, Former CTO Square, Creator of CashApp, Stabbed to Death in SF
Bob was a nice guy. We had an overlapping tenure at Google in the 2000s. He was one of the original authors of the Guice dependency injection framework: https://github.com/google/guice. When I was earning Java readability at Google, I was fortunate to have had him assigned as a reviewer. Huge loss; he left a very positive impression on me.
-
Bob Lee Was Killed
He was fairly well known figure in the Java world. RIP.
[1] https://github.com/google/guice
-
Handling two contexts
Usually each context has a different scope and lifetime associated with it. Here, it sounds like there are two distinct scopes: server and request (cf. how Guice models scopes: https://github.com/google/guice/wiki/Scopes). It is rarely sensible to merge the scopes or contexts together. If we think about a context, it contains several things:
-
Anyone succeed in running GL5 + Opensearch on FreeBSD?
Exception in thread "main" com.google.inject.CreationException: Unable to create injector, see the following errors: 1) [Guice/MissingImplementation]: No implementation for Map> was bound. Did you mean? MoreSearchAdapter bound at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:57) SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : MoreSearchAdapterProvider.(MoreSearchAdapterProvider.java:31) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:57) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 2) [Guice/MissingImplementation]: No implementation for Map> was bound. Did you mean? V20200730000000_AddGl2MessageIdFieldAliasForEvents$ElasticsearchAdapter bound at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:65) SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : V20200730000000_AddGl2MessageIdFieldAliasForEventsElasticsearchAdapterProvider.(V20200730000000_AddGl2MessageIdFieldAliasForEventsElasticsearchAdapterProvider.java:34) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:65) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 3) [Guice/MissingImplementation]: No implementation for Map>> was bound. Did you mean? QueryBackend bound at VersionAwareStorageModule.bindQueryBackend(VersionAwareStorageModule.java:72) SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : ElasticsearchBackendProvider.(ElasticsearchBackendProvider.java:33) \_ for 2nd parameter at VersionAwareStorageModule.bindQueryBackend(VersionAwareStorageModule.java:72) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 4) [Guice/MissingImplementation]: No implementation for Map> was bound. Did you mean? SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) QuerySuggestionsService bound at ViewsBindings.configure(ViewsBindings.java:245) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : QuerySuggestionsProvider.(QuerySuggestionsProvider.java:31) \_ for 2nd parameter at ViewsBindings.configure(ViewsBindings.java:245) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 5) [Guice/MissingImplementation]: No implementation for Map> was bound. Did you mean? SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) ExportBackend bound at ViewsBindings.registerExportBackendProvider(ViewsBindings.java:255) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : ExportBackendProvider.(ExportBackendProvider.java:31) \_ for 2nd parameter at ViewsBindings.registerExportBackendProvider(ViewsBindings.java:255) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 6) [Guice/MissingImplementation]: No implementation for Map> was bound. Did you mean? IndexToolsAdapter bound at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:62) SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : IndexToolsAdapterProvider.(IndexToolsAdapterProvider.java:31) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:62) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 7) [Guice/MissingImplementation]: No implementation for Map> was bound. Requested by: 1 : ClusterAdapterProvider.(ClusterAdapterProvider.java:31) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:59) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 8) [Guice/MissingImplementation]: No implementation for Map> was bound. Requested by: 1 : NodeAdapterProvider.(NodeAdapterProvider.java:31) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:60) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 9) [Guice/MissingImplementation]: No implementation for Map> was bound. Did you mean? CountsAdapter bound at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:54) SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : CountsAdapterProvider.(CountsAdapterProvider.java:31) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:54) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 10) [Guice/MissingImplementation]: No implementation for Map> was bound. Did you mean? IndexFieldTypePollerAdapter bound at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:61) SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : IndexFieldTypePollerAdapterProvider.(IndexFieldTypePollerAdapterProvider.java:31) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:61) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 11) [Guice/MissingImplementation]: No implementation for Map> was bound. Did you mean? StreamsForFieldRetriever bound at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:53) SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : StreamsForFieldRetrieverProvider.(StreamsForFieldRetrieverProvider.java:33) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:53) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 12) [Guice/MissingImplementation]: No implementation for Map> was bound. Did you mean? IndicesAdapter bound at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:55) SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : IndicesAdapterProvider.(IndicesAdapterProvider.java:31) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:55) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 13) [Guice/MissingImplementation]: No implementation for Map> was bound. Requested by: 1 : MessagesAdapterProvider.(MessagesAdapterProvider.java:31) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:58) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 14) [Guice/MissingImplementation]: No implementation for Map> was bound. Did you mean? SearchesAdapter bound at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:56) SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : SearchesAdapterProvider.(SearchesAdapterProvider.java:31) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:56) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 15) [Guice/MissingImplementation]: No implementation for Map> was bound. Did you mean? V20170607164210_MigrateReopenedIndicesToAliases$ClusterState bound at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:63) SearchVersion annotated with interface DetectedSearchVersion bound at ElasticsearchModule.configure(ElasticsearchModule.java:30) SearchVersion annotated with @Named("elasticsearch_version") bound at NamedConfigParametersModule.registerParameters(NamedConfigParametersModule.java:80) Requested by: 1 : V20170607164210_MigrateReopenedIndicesToAliasesClusterStateAdapterProvider.(V20170607164210_MigrateReopenedIndicesToAliasesClusterStateAdapterProvider.java:31) \_ for 2nd parameter at VersionAwareStorageModule.configure(VersionAwareStorageModule.java:63) Learn more: https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION 15 errors ====================== Full classname legend: ====================== ClusterAdapter: "org.graylog2.indexer.cluster.ClusterAdapter" ClusterAdapterProvider: "org.graylog2.storage.providers.ClusterAdapterProvider" CountsAdapter: "org.graylog2.indexer.counts.CountsAdapter" CountsAdapterProvider: "org.graylog2.storage.providers.CountsAdapterProvider" DetectedSearchVersion: "org.graylog2.storage.DetectedSearchVersion" ElasticsearchBackendProvider: "org.graylog2.storage.providers.ElasticsearchBackendProvider" ElasticsearchModule: "org.graylog2.bindings.ElasticsearchModule" ExportBackend: "org.graylog.plugins.views.search.export.ExportBackend" ExportBackendProvider: "org.graylog.plugins.views.providers.ExportBackendProvider" GeneratedQueryContext: "org.graylog.plugins.views.search.engine.GeneratedQueryContext" IndexFieldTypePollerAdapter: "org.graylog2.indexer.fieldtypes.IndexFieldTypePollerAdapter" IndexFieldTypePollerAdapterProvider: "org.graylog2.storage.providers.IndexFieldTypePollerAdapterProvider" IndexToolsAdapter: "org.graylog2.indexer.IndexToolsAdapter" IndexToolsAdapterProvider: "org.graylog2.storage.providers.IndexToolsAdapterProvider" IndicesAdapter: "org.graylog2.indexer.indices.IndicesAdapter" IndicesAdapterProvider: "org.graylog2.storage.providers.IndicesAdapterProvider" MessagesAdapter: "org.graylog2.indexer.messages.MessagesAdapter" MessagesAdapterProvider: "org.graylog2.storage.providers.MessagesAdapterProvider" MoreSearchAdapter: "org.graylog.events.search.MoreSearchAdapter" MoreSearchAdapterProvider: "org.graylog2.storage.providers.MoreSearchAdapterProvider" Named: "com.google.inject.name.Named" NamedConfigParametersModule: "com.github.joschi.jadconfig.guice.NamedConfigParametersModule" NodeAdapter: "org.graylog2.indexer.cluster.NodeAdapter" NodeAdapterProvider: "org.graylog2.storage.providers.NodeAdapterProvider" Provider: "javax.inject.Provider" QueryBackend: "org.graylog.plugins.views.search.engine.QueryBackend" QuerySuggestionsProvider: "org.graylog.plugins.views.providers.QuerySuggestionsProvider" QuerySuggestionsService: "org.graylog.plugins.views.search.engine.QuerySuggestionsService" SearchVersion: "org.graylog2.storage.SearchVersion" SearchesAdapter: "org.graylog2.indexer.searches.SearchesAdapter" SearchesAdapterProvider: "org.graylog2.storage.providers.SearchesAdapterProvider" StreamsForFieldRetriever: "org.graylog2.indexer.fieldtypes.streamfiltered.esadapters.StreamsForFieldRetriever" StreamsForFieldRetrieverProvider: "org.graylog2.storage.providers.StreamsForFieldRetrieverProvider" V20170607164210_MigrateReopenedIndicesToAliases$ClusterState: "org.graylog2.migrations.V20170607164210_MigrateReopenedIndicesToAliases$ClusterState" V20170607164210_MigrateReopenedIndicesToAliasesClusterStateAdapterProvider: "org.graylog2.storage.providers.V20170607164210_MigrateReopenedIndicesToAliasesClusterStateAdapterProvider" V20200730000000_AddGl2MessageIdFieldAliasForEvents$ElasticsearchAdapter: "org.graylog.plugins.views.migrations.V20200730000000_AddGl2MessageIdFieldAliasForEvents$ElasticsearchAdapter" V20200730000000_AddGl2MessageIdFieldAliasForEventsElasticsearchAdapterProvider: "org.graylog2.storage.providers.V20200730000000_AddGl2MessageIdFieldAliasForEventsElasticsearchAdapterProvider" VersionAwareStorageModule: "org.graylog2.storage.VersionAwareStorageModule" ViewsBindings: "org.graylog.plugins.views.ViewsBindings" ======================== End of classname legend: ======================== at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:568) at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:163) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110) at com.google.inject.Guice.createInjector(Guice.java:87) at org.graylog2.shared.bindings.GuiceInjectorHolder.createInjector(GuiceInjectorHolder.java:34) at org.graylog2.bootstrap.CmdLineTool.setupInjector(CmdLineTool.java:502) at org.graylog2.bootstrap.CmdLineTool.doRun(CmdLineTool.java:306) at org.graylog2.bootstrap.CmdLineTool.run(CmdLineTool.java:260) at org.graylog2.bootstrap.Main.main(Main.java:45)
-
Dependency Injection in Scala - cake pattern
using libraries from java world, such as Guice;
-
Dependency injection with AWS Lambdas in java
As said in the title, we will focus on the dependency inversion principle and one of its application : dependency injection. For production-ready applications, it would be better to rely on a framework and not implement its own container. For it, the java ecosystem have 3 frameworks available : Spring, Guice and Dagger.
Weld
-
Implement a plugin architecture
I've been using CDI for something like this. The project is temporarily hosted here.
-
Show HN: I finished v5 of a JVM framework I've spent spent half a decade making
Any DI lib would probably work, it depends on your preferences and use cases though.
I'm personally a fan of Weld since its the reference implementation of the CDI spec.
https://weld.cdi-spec.org/
- Weld 5.0.0.Beta1 released!
-
Non Spring users what are you using ??
Need only Dependency injection? Perhaps JBoss Weld, a reference CDI implementation, might interest you.
What are some alternatives?
Dagger2 - A fast dependency injector for Android and Java.
HK2
Apache DeltaSpike - Mirror of Apache Deltaspike
Dynamic CDI - Dynamic Context Dependency Injection
Feather - Lightweight dependency injection for Java and Android (JSR-330)
Governator - Governator is a library of extensions and utilities that enhance Google Guice to provide: classpath scanning and automatic binding, lifecycle management, configuration to field mapping, field validation and parallelized object warmup.
butterknife - Bind Android views and callbacks to fields and methods.