本文整理了Java中com.google.inject.Inject
类的一些代码示例,展示了Inject
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Inject
类的具体详情如下:
包路径:com.google.inject.Inject
类名称:Inject
暂无
代码示例来源:origin: Netflix/eureka
@Singleton
static class ModuleConfig {
@Inject
Config config;
@Inject(optional = true)
@Named(InternalEurekaClientModule.INSTANCE_CONFIG_NAMESPACE_KEY)
String instanceConfigNamespace;
@Inject(optional = true)
@Named(InternalEurekaClientModule.CLIENT_CONFIG_NAMESPACE_KEY)
String clientConfigNamespace;
@Inject(optional = true)
EurekaInstanceConfigFactory instanceConfigFactory;
String getInstanceConfigNamespace() {
return instanceConfigNamespace == null ? "eureka" : instanceConfigNamespace;
}
String getClientConfigNamespace() {
return clientConfigNamespace == null ? "eureka" : clientConfigNamespace;
}
EurekaInstanceConfigFactory getInstanceConfigProvider() {
return instanceConfigFactory == null
? new CompositeInstanceConfigFactory(config, getInstanceConfigNamespace())
: instanceConfigFactory;
}
}
代码示例来源:origin: com.google.inject/guice
InjectableMember(TypeLiteral<?> declaringType, Annotation atInject) {
this.declaringType = declaringType;
if (atInject.annotationType() == javax.inject.Inject.class) {
optional = false;
jsr330 = true;
return;
}
jsr330 = false;
optional = ((Inject) atInject).optional();
}
代码示例来源:origin: killbill/killbill
@Inject
public DefaultCatalogService(final CatalogConfig config,
final TenantInternalApi tenantInternalApi,
final CatalogCache catalogCache,
@Named(CatalogModule.CATALOG_INVALIDATION_CALLBACK) final CacheInvalidationCallback cacheInvalidationCallback) {
this.config = config;
this.catalogCache = catalogCache;
this.cacheInvalidationCallback = cacheInvalidationCallback;
this.tenantInternalApi = tenantInternalApi;
this.isInitialized = false;
}
代码示例来源:origin: apache/incubator-druid
public class DataSourceTaskIdHolder
{
public static final String DATA_SOURCE_BINDING = "druidDataSource";
public static final String TASK_ID_BINDING = "druidTaskId";
@Named(DATA_SOURCE_BINDING)
@Inject(optional = true)
String dataSource = null;
@Named(TASK_ID_BINDING)
@Inject(optional = true)
String taskId = null;
public String getDataSource()
{
return dataSource;
}
public String getTaskId()
{
return taskId;
}
}
代码示例来源:origin: jclouds/legacy-jclouds
@Inject
@VisibleForTesting
ConcurrentOpenSocketFinder(SocketOpen socketTester,
@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
this.socketTester = checkNotNull(socketTester, "socketTester");
this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning");
this.userExecutor = listeningDecorator(checkNotNull(userExecutor, "userExecutor"));
}
代码示例来源:origin: apache/incubator-druid
@Inject
public SearchQueryRunnerFactory(
SearchStrategySelector strategySelector,
SearchQueryQueryToolChest toolChest,
QueryWatcher queryWatcher
)
{
this.strategySelector = strategySelector;
this.toolChest = toolChest;
this.queryWatcher = queryWatcher;
}
代码示例来源:origin: apache/incubator-druid
@Inject
public void inject(Injector injector)
{
final List<Binding<Emitter>> emitterBindings = injector.findBindingsByType(new TypeLiteral<Emitter>(){});
emitter = findEmitter(emitterType, emitterBindings);
if (emitter == null) {
emitter = findEmitter(NoopEmitterModule.EMITTER_TYPE, emitterBindings);
}
if (emitter == null) {
List<String> knownTypes = new ArrayList<>();
for (Binding<Emitter> binding : emitterBindings) {
final Annotation annotation = binding.getKey().getAnnotation();
if (annotation != null) {
knownTypes.add(((Named) annotation).value());
}
}
throw new ISE("Unknown emitter type[%s]=[%s], known types[%s]", EMITTER_PROPERTY, emitterType, knownTypes);
}
}
代码示例来源:origin: killbill/killbill
@Inject
public OverdueCheckPoster(final NotificationQueueService notificationQueueService,
final IDBI dbi, @Named(MAIN_RO_IDBI_NAMED) final IDBI roDbi, final Clock clock, final CacheControllerDispatcher cacheControllerDispatcher,
final NonEntityDao nonEntityDao, final InternalCallContextFactory internalCallContextFactory) {
super(notificationQueueService, dbi, roDbi, clock, cacheControllerDispatcher, nonEntityDao, internalCallContextFactory);
}
代码示例来源:origin: Netflix/conductor
@Inject
public EventQueues(@Named(EVENT_QUEUE_PROVIDERS_QUALIFIER) Map<String, EventQueueProvider> providers, ParametersUtils parametersUtils) {
this.providers = providers;
this.parametersUtils = parametersUtils;
}
代码示例来源:origin: org.apache.jclouds/jclouds-compute
@Inject
@VisibleForTesting
ConcurrentOpenSocketFinder(SocketOpen socketTester,
@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
this.socketTester = checkNotNull(socketTester, "socketTester");
this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning");
this.userExecutor = listeningDecorator(checkNotNull(userExecutor, "userExecutor"));
}
代码示例来源:origin: apache/incubator-druid
@Inject
public SupervisorResourceFilter(
AuthorizerMapper authorizerMapper,
SupervisorManager supervisorManager
)
{
super(authorizerMapper);
this.supervisorManager = supervisorManager;
}
代码示例来源:origin: jclouds/legacy-jclouds
@Singleton
public static class InitStatusProperties {
@Inject(optional = true)
@Named(INIT_STATUS_INITIAL_PERIOD)
public long initStatusInitialPeriod = 500;
@Inject(optional = true)
@Named(INIT_STATUS_MAX_PERIOD)
public long initStatusMaxPeriod = 5000;
}
代码示例来源:origin: killbill/killbill
@Inject
public OverdueAsyncBusPoster(final NotificationQueueService notificationQueueService,
final IDBI dbi, @Named(MAIN_RO_IDBI_NAMED) final IDBI roDbi, final Clock clock, final CacheControllerDispatcher cacheControllerDispatcher,
final NonEntityDao nonEntityDao, final InternalCallContextFactory internalCallContextFactory) {
super(notificationQueueService, dbi, roDbi, clock, cacheControllerDispatcher, nonEntityDao, internalCallContextFactory);
}
代码示例来源:origin: kairosdb/kairosdb
@Inject
public PutCommand(FilterEventBus eventBus, @Named("HOSTNAME") String hostname,
LongDataPointFactory longFactory, DoubleDataPointFactory doubleFactory)
{
super(eventBus, hostname, longFactory, doubleFactory);
}
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-compute
@Inject
@VisibleForTesting
ConcurrentOpenSocketFinder(SocketOpen socketTester,
@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
this.socketTester = checkNotNull(socketTester, "socketTester");
this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning");
this.userExecutor = listeningDecorator(checkNotNull(userExecutor, "userExecutor"));
}
代码示例来源:origin: apache/incubator-druid
@Inject
public OmniDataSegmentMover(
Map<String, DataSegmentMover> movers
)
{
this.movers = movers;
}
代码示例来源:origin: com.google.inject/guice
optional = guiceInject.optional();
代码示例来源:origin: jclouds/legacy-jclouds
@Singleton
public static class PollPeriod {
@Inject(optional = true)
@Named(POLL_INITIAL_PERIOD)
public long pollInitialPeriod = Predicates2.DEFAULT_PERIOD;
@Inject(optional = true)
@Named(POLL_MAX_PERIOD)
public long pollMaxPeriod = Predicates2.DEFAULT_MAX_PERIOD;
}
代码示例来源:origin: apache/shiro
@Inject
WebGuiceEnvironment(FilterChainResolver filterChainResolver, @Named(ShiroWebModule.NAME) ServletContext servletContext, WebSecurityManager securityManager) {
this.filterChainResolver = filterChainResolver;
this.servletContext = servletContext;
this.securityManager = securityManager;
servletContext.setAttribute(EnvironmentLoaderListener.ENVIRONMENT_ATTRIBUTE_KEY, this);
}
代码示例来源:origin: kairosdb/kairosdb
@Inject
public CacheFileCleaner(@Named(CLEANING_SCHEDULE) String schedule, KairosDatastore datastore)
{
this.datastore = datastore;
this.schedule = schedule;
}
内容来源于网络,如有侵权,请联系作者删除!