相关疑难解决方法(0)

Guice单身人士是否尊重线程限制?

我对Guice以及它的单身人士是否会服从我可能尝试设置的线程限制表示关注:

public class CacheModule extends AbstractModule {
    @Override
    protected void configure() {
        // WidgetCache.class is located inside a 3rd party JAR that I
        // don't have the ability to modify.
        WidgetCache widgetCache = new WidgetCache(...lots of params);

        // Guice will reuse the same WidgetCache instance over and over across
        // multiple calls to Injector#getInstance(WidgetCache.class);
        bind(WidgetCache.class).toInstance(widgetCache);
    }
}

// CacheAdaptor is the "root" of my dependency tree. All other objects
// are created from it.
public class CacheAdaptor {
    private CacheModule …
Run Code Online (Sandbox Code Playgroud)

java singleton dependency-injection guice

5
推荐指数
1
解决办法
4060
查看次数

标签 统计

dependency-injection ×1

guice ×1

java ×1

singleton ×1