javax.inject.Inject.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(203)

本文整理了Java中javax.inject.Inject.<init>()方法的一些代码示例,展示了Inject.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Inject.<init>()方法的具体详情如下:
包路径:javax.inject.Inject
类名称:Inject
方法名:<init>

Inject.<init>介绍

暂无

代码示例

代码示例来源:origin: Graylog2/graylog2-server

@Inject
public ClusterEventBusProvider(@Named("async_eventbus_processors") final int asyncEventbusProcessors,
                final MetricRegistry metricRegistry) {
  this.asyncEventbusProcessors = asyncEventbusProcessors;
  this.metricRegistry = metricRegistry;
}

代码示例来源:origin: square/dagger

@Singleton
public static class L {
 @Inject @Named("one") F f;
 @Inject Provider<L> lProvider;
}

代码示例来源:origin: HubSpot/Singularity

@Inject
public SingularityLeaderLatch(@Named(SingularityMainModule.HTTP_HOST_AND_PORT) final HostAndPort httpHostAndPort,
  final CuratorFramework curatorFramework, final Set<LeaderLatchListener> listeners) throws Exception {
 super(checkNotNull(curatorFramework, "curatorFramework is null"), LEADER_PATH, httpHostAndPort.toString());
 checkNotNull(listeners, "listeners is null");
 for (LeaderLatchListener listener : listeners) {
  addListener(listener);
 }
}

代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-syntax-event

@Component
@Named("event/1.0")
@Singleton
public class EventBlockRenderer extends AbstractBlockRenderer
{
  @Inject
  @Named("event/1.0")
  private PrintRendererFactory eventRendererFactory;

  @Override
  protected PrintRendererFactory getPrintRendererFactory()
  {
    return this.eventRendererFactory;
  }
}

代码示例来源:origin: javaee/glassfish

@Service
public final class Transactions implements PostConstruct, PreDestroy {
  @Inject @Named("transactions-executor") @Optional
  private ExecutorService executor;

代码示例来源:origin: jvelo/mayocat-shop

@Component("elasticsearch")
public class ElasticSearchManaged implements Managed
{

  @Inject
  @Named("elasticsearch")
  private SearchEngine searchEngine;

  @Override
  public void start() throws Exception
  {
    ((ElasticSearchSearchEngine) searchEngine).start();
  }

  @Override
  public void stop() throws Exception
  {
    ((ElasticSearchSearchEngine) searchEngine).stop();
  }

}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-captcha-default

/**
 * Default implementation for {@link CaptchaConfiguration}.
 *
 * @version $Id: 1834827b33ae612bb4fe0369ad395505ca58d4e4 $
 * @since 10.8RC1
 */
@Component
@Singleton
public class DefaultCaptchaConfiguration implements CaptchaConfiguration
{
  @Inject
  @Named("captcha")
  private ConfigurationSource configuration;

  @Override
  public String getDefaultName()
  {
    return configuration.getProperty("captcha", "jcaptcha");
  }
}

代码示例来源:origin: jclouds/legacy-jclouds

@Inject
public FindSecurityGroupOrCreate(
    @Named(TIMEOUT_SECURITYGROUP_PRESENT) Predicate<AtomicReference<ZoneAndName>> returnSecurityGroupExistsInZone,
    Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator) {
 this.returnSecurityGroupExistsInZone = checkNotNull(returnSecurityGroupExistsInZone,
      "returnSecurityGroupExistsInZone");
 this.groupCreator = checkNotNull(groupCreator, "groupCreator");
}

代码示例来源:origin: Graylog2/graylog2-server

@Inject
public StreamCacheService(EventBus eventBus,
             StreamService streamService,
             @Named("daemonScheduler") ScheduledExecutorService executorService) {
  this.eventBus = eventBus;
  this.streamService = streamService;
  this.executorService = executorService;
}

代码示例来源:origin: apache/maven

@Named
@Singleton
public class DefaultToolchainsBuilder
  implements ToolchainsBuilder
  @Inject
  private ToolchainsReader toolchainsReader;

代码示例来源:origin: org.glassfish.main.common/glassfish-api

/**
 * Convenience implementation that delegate to a provided system executor. This
 * provider will be looked up from the habitat by its type ClusterExecutor and the
 * "target" name. 
 */
@Service
public final class TargetBasedExecutor implements ClusterExecutor {

  @Inject
  @Named("GlassFishClusterExecutor")
  private ClusterExecutor delegate=null;

  @Override
  public ActionReport.ExitCode execute(String commandName, AdminCommand command, AdminCommandContext context, ParameterMap parameters) {
    return delegate.execute(commandName, command, context, parameters);
  }
}

代码示例来源:origin: phenotips/phenotips

/**
 * Default implementation for {@link PrincipalsResource} using XWiki's support for REST resources.
 *
 * @version $Id: dffc755590fda97243ae5c02ff8762656c597f74 $
 * @since 1.4
 */
@Component
@Named("org.phenotips.users.rest.internal.DefaultPrincipalsResourceImpl")
@Singleton
public class DefaultPrincipalsResourceImpl extends XWikiResource implements PrincipalsResource
{
  @Inject
  private UsersAndGroups usersAndGroups;

  @Override
  public Response getAllUsersAndGroups()
  {
    JSONObject json = this.usersAndGroups.getAll();
    return Response.ok(json, MediaType.APPLICATION_JSON_TYPE).build();
  }
}

代码示例来源:origin: jclouds/legacy-jclouds

@Inject
public BucketsToStorageMetadata(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, BucketToResourceMetadata bucket2ResourceMd) {
 this.userExecutor = checkNotNull(userExecutor, "userExecutor");
 this.bucket2ResourceMd = checkNotNull(bucket2ResourceMd, "bucket2ResourceMd");
}

代码示例来源:origin: Graylog2/graylog2-server

@Inject
public ProxiedRequestsExecutorService(@Named("proxied_requests_thread_pool_size") int proxiedRequestsMaxThreads) {
  this.proxiedRequestsMaxThreads = proxiedRequestsMaxThreads;
}

代码示例来源:origin: 58code/Argo

@Singleton
public class StatusCodeActionResult {
  @Inject
  @Named("HTTP_STATUS=404")
  ActionResult sc404;
  @Inject
  @Named("HTTP_STATUS=405")
  ActionResult sc405;

代码示例来源:origin: eclipse-ee4j/glassfish

/**
 * Convenience implementation that delegate to a provided system executor. This
 * provider will be looked up from the habitat by its type ClusterExecutor and the
 * "target" name. 
 */
@Service
public final class TargetBasedExecutor implements ClusterExecutor {

  @Inject
  @Named("GlassFishClusterExecutor")
  private ClusterExecutor delegate=null;

  @Override
  public ActionReport.ExitCode execute(String commandName, AdminCommand command, AdminCommandContext context, ParameterMap parameters) {
    return delegate.execute(commandName, command, context, parameters);
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-instance

/**
 * Provides instance-specific scripting APIs.
 * 
 * @version $Id: 014cc515d7d7980343ad71d9916d6e2f1f980c5b $
 * @since 8.3RC1
 */
@Component
@Named("instance")
@Singleton
public class InstanceScriptService implements ScriptService
{
  @Inject
  private InstanceIdManager instanceIdManager;

  /**
   * @return the XWiki instance id or null if not set, see {@link InstanceIdManager#getInstanceId()}
   */
  public InstanceId getInstanceId()
  {
    return instanceIdManager.getInstanceId();
  }
}

代码示例来源:origin: jclouds/legacy-jclouds

@Inject
VAppTemplatesSupplier(Supplier<Map<String, Org>> orgMap,
    Function<Org, Iterable<VAppTemplate>> imagesInOrg,
    @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
 this.orgMap = checkNotNull(orgMap, "orgMap");
 this.imagesInOrg = checkNotNull(imagesInOrg, "imagesInOrg");
 this.userExecutor = checkNotNull(userExecutor, "userExecutor");
}

代码示例来源:origin: Graylog2/graylog2-server

@Inject
public ClusterDeflectorResource(@Context HttpHeaders httpHeaders,
                NodeService nodeService,
                RemoteInterfaceProvider remoteInterfaceProvider,
                @Named("proxiedRequestsExecutorService") ExecutorService executorService) {
  super(httpHeaders, nodeService, remoteInterfaceProvider, executorService);
}

代码示例来源:origin: vdevigere/undertow-cdi-jaxrs

@Singleton
@Path("/singleton")
public class MySingletonResource {

  @Named("Single")
  @Inject
  private String message;

  @GET
  @Produces(MediaType.TEXT_PLAIN)
  public String helloSingleton(){
    return message;
  }
}

相关文章

Inject类方法