腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(5703)
视频
沙龙
1
回答
如何使用
Guice
的AssistedInject工厂和服务加载器?
、
、
、
在我的
guice
模块中,有多个工厂,如下所示:
MapBinder
<String, CarFactory>
mapbinder
=
MapBinder
.
浏览 1
提问于2016-07-18
得票数 1
回答已采纳
1
回答
Guice
中的空多粘合剂/
MapBinder
、
、
、
在使用构建插件体系结构的过程中,使用,我遇到了这样的问题:当去掉所有模块时,
Guice
抛出一个CreationException,这在这个应用程序中是可行的配置。有没有办法让
Guice
注入一个空的Map?class PlugInRegistry { public PlugInRegistry(Map<String, PlugIn> plugins) {
浏览 1
提问于2015-04-28
得票数 3
回答已采纳
1
回答
将密钥注入
MapBinder
、
我正在尝试使用
Guice
将Map注入到一个类中,其中map的形式为Map<MyInterface, Integer>。我想使用
MapBinder
扩展来实现这一点,但是看起来
MapBinder
需要一个实例化的对象作为键。我想让
Guice
注入键的实例化,因为它们是需要自己注入的复杂对象。也就是说,类似于:
MapBinder
.newMapBinder(b
浏览 1
提问于2010-09-17
得票数 0
回答已采纳
1
回答
Guice
-基于外部参数动态选择提供程序
、
在
guice
中,有没有一种方法可以根据一些外部参数为绑定选择特定的实现public interface Service {} } Injector injector =
Guice
.createInjector如果我想让它更动态,比如说,基于用户偏好,有没有一种方法可以在运行时等待选择提供者并让
guice<
浏览 0
提问于2015-10-18
得票数 0
2
回答
Guice
:使用@命名的注入映射绑定
、
、
这和
Guice
有可能吗?模块:
MapBinder
<String, IService>
mapBinder
=
MapBinder
.newMapBinder(binder(), String.class, IService.class);
mapBinder
.addBindin
浏览 4
提问于2015-07-04
得票数 3
回答已采纳
1
回答
如何根据类的注释值动态创建类的实例?
、
、
每个类都有一个注释@Work(name=“对应的名称”) 每个类都有不同的私有字段,在构建过程中使用
guice
注入这些字段。
浏览 5
提问于2019-12-12
得票数 0
2
回答
MapBinder
-
Guice
4.0 beta4所需的显式绑定
、
、
今天早上,我试着把
Guice
版本从4.0-beta升级到4.0-beta 4,我的
MapBinder
出现了问题。我有一个扩展JerseyServletModule的基本模块。在configureServlets()方法中,我需要:
MapBinder
<String, ExportData> exportDataMapBinder =
MapBinder
.newMapBinder使用
Guice
4.0-beta可以很好地工作,但是使用
Guice
4.0-beta 4时,我开
浏览 4
提问于2014-06-26
得票数 1
回答已采纳
1
回答
guice
、
MapBinder
和参数化接口
、
我正在使用
guice
和
MapBinder
。implements IService<String, String>我想像这样使用
MapBinder
:
MapBinder
.newMapBinde
浏览 1
提问于2013-04-21
得票数 0
回答已采纳
1
回答
使用
guice
动态绑定实例
、
有没有办法使用
guice
“提供”实例?使用
guice
,我可以将实例绑定到任意构造函数或“实现”。
浏览 0
提问于2014-04-23
得票数 0
1
回答
是否可以设置MapBinding返回不同的实例
、
我有一个如下的Gucie绑定设置:
mapBinder
.addBinding("a").to(MyClassA.class);
mapBinder
.addBinding("b")有没有办法将Gucie配置为总是从<
浏览 2
提问于2013-08-19
得票数 1
1
回答
Guice
可以注入一些需要查找函数的东西吗?
、
、
我在Restlet web服务器中使用
Guice
,但有一种模式我无法理解:如何注入特定于特定用户或特定请求的对象。 假设我们有一个请求,要求列出属于某个项目的所有小部件。
浏览 3
提问于2014-10-09
得票数 0
1
回答
在
Guice
中使用
Mapbinder
在模块中使用Inject
、
、
我使用
Guice
MapBinder
将接口的不同实现绑定到特定的键上。问题是,我需要在这些绑定中注入一些依赖项。我认为这是不可能的,因为我需要通过这样做来初始化模块:有可能吗?}public class SomeModule extends AbstractModule { protected void configure() {
MapBinder
<String, SecureToken>
浏览 0
提问于2015-11-27
得票数 1
回答已采纳
2
回答
Guice
MapBinder
、
、
、
我在Java + Kotlin项目中使用
Guice
将算法实现的映射注入到特定的bean中,但我不断得到模块的定义如下所示:
MapBinder
.newMapBinder
浏览 8
提问于2017-07-25
得票数 1
2
回答
如何在Google
Guice
中动态确定绑定
、
TemplateFactory.createTemplate(message); }考虑到绑定是在运行时动态确定的,如何使用Google
Guice
浏览 2
提问于2012-10-28
得票数 0
2
回答
通过Google
Guice
使用字符串文字检索实例
、
我有多个模块,它们的服务接口绑定到它们相应的类型,并且我能够通过使用我想使用以下命令检索实例即字符串文字,而不是类类型为了进一步阐述我的问题-我可以使用Class.forName(literal)调用从字符串文字中检索类对象,然后使用它通过injector.getInstance(clsInstance)检索实例。 在检索到我在基本服务类型接口中接收到的实例之后,我需要
浏览 0
提问于2014-05-22
得票数 1
1
回答
在
Guice
中从
MapBinder
上获取实现
、
基本上,我想了解
MapBinder
是如何工作的。例如,我试着去寻找,但找不到一个能让我满意的。在我提问之前,这里是我的一些设置。public class MyModule extends AbstractModule { protected void configure() { binder.addBinding("one"
浏览 4
提问于2015-06-05
得票数 0
回答已采纳
1
回答
基于
Guice
的模块化Java插件系统
、
、
theCorrectInterfaceImplementation) {我正在查找MapBindings、AssistedInjection和FactoryModuleBuilder,但不确定如何获得正确的
Guice
浏览 4
提问于2016-05-17
得票数 2
回答已采纳
1
回答
如何将已安装的
MapBinder
添加附加绑定到其中
、
我用com.google.inject:
guice
。在我的项目中,我包含了一个依赖项,它有一个模块(一个扩展com.google.inject.AbstractModule的类),它定义了这样一个
MapBinder
。class MyGuiceModule extends AbstractModule { protected void configure() {
MapBinder
<String, SomeModuleClass> parentModules =
浏览 1
提问于2019-04-24
得票数 0
回答已采纳
1
回答
如何实例化包含使用
Guice
中映射绑定实例化的Map实例变量的对象
、
、
如果一个对象(我们称之为workController) )包含到处理程序(Map<String, Handler> handlerMap)的字符串映射,则使用
Guice
模块内的
mapBinder
和其他也被注入的实例变量将字符串注入到它将映射注入相应的
Guice
模块,如下所示: protected<String, handler>
mapBinder
浏览 3
提问于2017-06-26
得票数 0
1
回答
使用
guice
的构造函数参数注入
、
所以我使用一个
MapBinder
来存储一堆实现,然后在运行时根据一些标准选择一个。public class MessageModule extends AbstractModule { protected void configure() {
mapBinder
.addBinding(&q
浏览 0
提问于2015-06-19
得票数 1
点击加载更多
热门
标签
更多标签
云服务器
ICP备案
对象存储
云点播
实时音视频
活动推荐
运营活动
广告
关闭
领券