• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java New类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.enterprise.inject.New的典型用法代码示例。如果您正苦于以下问题:Java New类的具体用法?Java New怎么用?Java New使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



New类属于javax.enterprise.inject包,在下文中一共展示了New类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: create

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Singleton
public CuratorFramework create(@ServiceName("ZOOKEEPER") String url, @New CuratorConfig config) throws IOException, InterruptedException {
    LOG.info("Connecting to ZooKeeper URL: {}", url);
    CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
            .connectString(url)
            .connectionTimeoutMs(config.getConnectionTimeOut())
            .sessionTimeoutMs(config.getSessionTimeout())
            .retryPolicy(new RetryNTimes(config.getRetryMax(), config.getRetryInterval()));

    if (!Strings.isNullOrBlank(config.getPassword())) {
        byte[] auth = (DEFAULT_AUTH_USER + ":" + PasswordEncoder.decode(config.getPassword())).getBytes();
        builder = builder.authorization(DEFAULT_AUTH_SCHEME, auth);
    }
    CuratorFramework curatorFramework = builder.build();
    curatorFramework.start();
    return curatorFramework;
}
 
开发者ID:fabric8io,项目名称:jube,代码行数:19,代码来源:CuratorServiceFactory.java


示例2: provideStorage

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@ApplicationScoped
public static IStorage provideStorage(ManagerApiMicroServiceConfig config, @New JpaStorage jpaStorage,
        @New EsStorage esStorage, IPluginRegistry pluginRegistry) {
    IStorage storage;
    if ("jpa".equals(config.getStorageType())) { //$NON-NLS-1$
        storage = initJpaStorage(config, jpaStorage);
    } else if ("es".equals(config.getStorageType())) { //$NON-NLS-1$
        storage = initES(config, esStorage);
    } else {
        try {
            storage = createCustomComponent(IStorage.class, config.getStorageType(),
                    config.getStorageProperties(), pluginRegistry);
        } catch (Throwable t) {
            throw new RuntimeException("Error or unknown storage type: " + config.getStorageType(), t); //$NON-NLS-1$
        }
    }
    return storage;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:20,代码来源:ManagerApiMicroServiceCdiFactory.java


示例3: provideStorageQuery

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IStorageQuery provideStorageQuery(ManagerApiMicroServiceConfig config, @New JpaStorage jpaStorage,
        @New EsStorage esStorage, IPluginRegistry pluginRegistry) {
    if ("jpa".equals(config.getStorageQueryType())) { //$NON-NLS-1$
        return initJpaStorage(config, jpaStorage);
    } else if ("es".equals(config.getStorageQueryType())) { //$NON-NLS-1$
        return initES(config, esStorage);
    } else {
        try {
            return createCustomComponent(IStorageQuery.class, config.getStorageQueryType(),
                    config.getStorageQueryProperties(), pluginRegistry);
        } catch (Throwable t) {
            throw new RuntimeException("Error or unknown storage query type: " + config.getStorageType(), t); //$NON-NLS-1$
        }
    }
}
 
开发者ID:apiman,项目名称:apiman,代码行数:17,代码来源:ManagerApiMicroServiceCdiFactory.java


示例4: provideMetricsAccessor

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IMetricsAccessor provideMetricsAccessor(ManagerApiMicroServiceConfig config,
        @New NoOpMetricsAccessor noopMetrics, @New ESMetricsAccessor esMetrics, IPluginRegistry pluginRegistry) {
    IMetricsAccessor metrics;
    if ("es".equals(config.getMetricsType())) { //$NON-NLS-1$
        metrics = esMetrics;
    } else {
        try {
            metrics = createCustomComponent(IMetricsAccessor.class, config.getMetricsType(),
                    config.getMetricsProperties(), pluginRegistry);
        } catch (Throwable t) {
            System.err.println("Unknown apiman metrics accessor type: " + config.getMetricsType()); //$NON-NLS-1$
            metrics = noopMetrics;
        }
    }
    return metrics;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:18,代码来源:ManagerApiMicroServiceCdiFactory.java


示例5: provideApiKeyGenerator

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IApiKeyGenerator provideApiKeyGenerator(ManagerApiMicroServiceConfig config,
        IPluginRegistry pluginRegistry, @New UuidApiKeyGenerator uuidApiKeyGen) {
    IApiKeyGenerator apiKeyGenerator;
    String type = config.getApiKeyGeneratorType();
    if ("uuid".equals(type)) { //$NON-NLS-1$
        apiKeyGenerator = uuidApiKeyGen;
    } else {
        try {
            apiKeyGenerator = createCustomComponent(IApiKeyGenerator.class, type,
                    config.getApiKeyGeneratorProperties(), pluginRegistry);
        } catch (Exception e) {
            System.err.println("Unknown apiman API key generator type: " + type); //$NON-NLS-1$
            System.err.println("Automatically falling back to UUID style API Keys."); //$NON-NLS-1$
            apiKeyGenerator = uuidApiKeyGen;
        }
    }
    return apiKeyGenerator;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:20,代码来源:ManagerApiMicroServiceCdiFactory.java


示例6: provideStorage

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IStorage provideStorage(WarApiManagerConfig config, @New JpaStorage jpaStorage,
        @New EsStorage esStorage, IPluginRegistry pluginRegistry) {
    IStorage storage;
    if ("jpa".equals(config.getStorageType())) { //$NON-NLS-1$
        storage = initJpaStorage(config, jpaStorage);
    } else if ("es".equals(config.getStorageType())) { //$NON-NLS-1$
        storage = initEsStorage(config, esStorage);
    } else {
        try {
            storage = createCustomComponent(IStorage.class, config.getStorageType(),
                    config.getStorageProperties(), pluginRegistry);
        } catch (Throwable t) {
            throw new RuntimeException("Error or unknown storage type: " + config.getStorageType(), t); //$NON-NLS-1$
        }
    }
    return storage;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:19,代码来源:WarCdiFactory.java


示例7: provideStorageQuery

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IStorageQuery provideStorageQuery(WarApiManagerConfig config, @New JpaStorage jpaStorage,
        @New EsStorage esStorage, IStorage storage, IPluginRegistry pluginRegistry) {
    if ("jpa".equals(config.getStorageType())) { //$NON-NLS-1$
        return initJpaStorage(config, jpaStorage);
    } else if ("es".equals(config.getStorageType())) { //$NON-NLS-1$
        return initEsStorage(config, esStorage);
    } else if (storage != null && storage instanceof IStorageQuery) {
        return (IStorageQuery) storage;
    } else {
        try {
            return createCustomComponent(IStorageQuery.class, config.getStorageQueryType(),
                    config.getStorageQueryProperties(), pluginRegistry);
        } catch (Throwable t) {
            throw new RuntimeException("Error or unknown storage query type: " + config.getStorageType(), t); //$NON-NLS-1$
        }
    }
}
 
开发者ID:apiman,项目名称:apiman,代码行数:19,代码来源:WarCdiFactory.java


示例8: provideMetricsAccessor

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IMetricsAccessor provideMetricsAccessor(WarApiManagerConfig config,
        @New NoOpMetricsAccessor noopMetrics, @New ESMetricsAccessor esMetrics, IPluginRegistry pluginRegistry) {
    IMetricsAccessor metrics;
    if ("es".equals(config.getMetricsType())) { //$NON-NLS-1$
        metrics = esMetrics;
    } else if (config.getMetricsType().equals(ESMetricsAccessor.class.getName())) {
        metrics = esMetrics;
    } else if ("noop".equals(config.getMetricsType())) { //$NON-NLS-1$
        metrics = noopMetrics;
    } else if (config.getMetricsType().equals(NoOpMetricsAccessor.class.getName())) {
        metrics = noopMetrics;
    } else {
        try {
            metrics = createCustomComponent(IMetricsAccessor.class, config.getMetricsType(),
                    config.getMetricsProperties(), pluginRegistry);
        } catch (Throwable t) {
            System.err.println("Unknown apiman metrics accessor type: " + config.getMetricsType()); //$NON-NLS-1$
            metrics = noopMetrics;
        }
    }
    return metrics;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:24,代码来源:WarCdiFactory.java


示例9: provideApiKeyGenerator

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IApiKeyGenerator provideApiKeyGenerator(WarApiManagerConfig config,
        @New UuidApiKeyGenerator uuidApiKeyGen, IPluginRegistry pluginRegistry) {
    IApiKeyGenerator apiKeyGenerator;
    String type = config.getApiKeyGeneratorType();
    if ("uuid".equals(type)) { //$NON-NLS-1$
        apiKeyGenerator = uuidApiKeyGen;
    } else {
        try {
            apiKeyGenerator = createCustomComponent(IApiKeyGenerator.class, type,
                    config.getApiKeyGeneratorProperties(), pluginRegistry);
        } catch (Exception e) {
            System.err.println("Unknown apiman API key generator type: " + type); //$NON-NLS-1$
            System.err.println("Automatically falling back to UUID style API Keys."); //$NON-NLS-1$
            apiKeyGenerator = uuidApiKeyGen;
        }
    }
    return apiKeyGenerator;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:20,代码来源:WarCdiFactory.java


示例10: produceDaoWithIntegerId

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@DAO
@SuppressWarnings("unchecked")
public <T> IDAO<T> produceDaoWithIntegerId(@TransientReference InjectionPoint ip,
                                           @TransientReference BeanManager bm,
                                           @New @TransientReference IDAOFactory f) {
    return buildDaoWithOneGenericType(ip, bm, (IDAOFactory<T>) f);
}
 
开发者ID:Tibor17,项目名称:javaee-samples,代码行数:10,代码来源:DaoProducer.java


示例11: produceDaoWithLongId

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@DAO
@SuppressWarnings("unchecked")
public <T> LDAO<T> produceDaoWithLongId(@TransientReference InjectionPoint ip,
                                        @TransientReference BeanManager bm,
                                        @New @TransientReference LDAOFactory f) {
    return buildDaoWithOneGenericType(ip, bm, (LDAOFactory<T>) f);
}
 
开发者ID:Tibor17,项目名称:javaee-samples,代码行数:10,代码来源:DaoProducer.java


示例12: produceUnqualifiedDaoWithIntegerId

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@Default
@SuppressWarnings("unchecked")
public <T> IDAO<T> produceUnqualifiedDaoWithIntegerId(@TransientReference InjectionPoint ip,
                                                      @TransientReference BeanManager bm,
                                                      @New @TransientReference IDAOFactory f) {
    return buildDaoWithOneGenericType(ip, bm, (IDAOFactory<T>) f);
}
 
开发者ID:Tibor17,项目名称:javaee-samples,代码行数:10,代码来源:DaoProducer.java


示例13: produceUnqualifiedDaoWithLongId

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@Default
@SuppressWarnings("unchecked")
public <T> LDAO<T> produceUnqualifiedDaoWithLongId(@TransientReference InjectionPoint ip,
                                                   @TransientReference BeanManager bm,
                                                   @New @TransientReference LDAOFactory f) {
    return buildDaoWithOneGenericType(ip, bm, (LDAOFactory<T>) f);
}
 
开发者ID:Tibor17,项目名称:javaee-samples,代码行数:10,代码来源:DaoProducer.java


示例14: produceDaoWithoutId

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@DAO
@SuppressWarnings("unchecked")
public <T> DaoWithoutId<T> produceDaoWithoutId(@TransientReference InjectionPoint ip,
                                               @TransientReference BeanManager bm,
                                               @New @TransientReference DAOFactory f) {
    return buildDaoWithOneGenericType(ip, bm, (DAOFactory<T>) f);
}
 
开发者ID:Tibor17,项目名称:javaee-samples,代码行数:10,代码来源:DaoProducer.java


示例15: produceUnqualifiedDaoWithoutId

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@Default
@SuppressWarnings("unchecked")
public <T> DaoWithoutId<T> produceUnqualifiedDaoWithoutId(@TransientReference InjectionPoint ip,
                                                          @TransientReference BeanManager bm,
                                                          @New @TransientReference DAOFactory f) {
    return buildDaoWithOneGenericType(ip, bm, (DAOFactory<T>) f);
}
 
开发者ID:Tibor17,项目名称:javaee-samples,代码行数:10,代码来源:DaoProducer.java


示例16: scopeCacheSupport

import javax.enterprise.inject.New; //导入依赖的package包/类
private static ScopeCacheSupport scopeCacheSupport(Annotation[] annotations) {
    if (null != filter(annotations, RequestScoped.class) ||
            null != filter(annotations, org.osgl.inject.annotation.RequestScoped.class)) {
        return RequestScope.INSTANCE;
    } else if (sessionScoped(annotations)) {
        return SessionScope.INSTANCE;
    } else if (null != filter(annotations, Dependent.class) ||
            null != filter(annotations, New.class)) {
        return DependentScope.INSTANCE;
    }
    // Default to Request Scope
    return RequestScope.INSTANCE;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:14,代码来源:ParamValueLoaderService.java


示例17: create

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@ServiceName("ZOOKEEPER")
public String create(@New ZooKeeperServerConfig serverConfig) throws IOException, InterruptedException {
    String providedUrl = Systems.getEnvVarOrSystemProperty("ZOOKEEPER_URL", "");
    if (Strings.isNullOrEmpty(providedUrl)) {
        ZooKeeperServerFactory factory =  new ZooKeeperServerFactory(serverConfig);
        return factory.getZooKeeperUrl();
    } else {
        return providedUrl;
    }
}
 
开发者ID:fabric8io,项目名称:jube,代码行数:12,代码来源:ZooKeeperUrlProducer.java


示例18: provideDataEncrypter

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IDataEncrypter provideDataEncrypter(ManagerApiMicroServiceConfig config,
        IPluginRegistry pluginRegistry, @New DefaultDataEncrypter defaultEncrypter) {
    try {
        IDataEncrypter encrypter = createCustomComponent(IDataEncrypter.class, config.getDataEncrypterType(),
                config.getDataEncrypterProperties(), pluginRegistry, defaultEncrypter);
        CurrentDataEncrypter.instance = encrypter;
        return encrypter;
    } catch (Throwable t) {
        throw new RuntimeException("Error or unknown data encrypter type: " + config.getDataEncrypterType(), t); //$NON-NLS-1$
    }
}
 
开发者ID:apiman,项目名称:apiman,代码行数:13,代码来源:ManagerApiMicroServiceCdiFactory.java


示例19: provideSecurityContext

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static ISecurityContext provideSecurityContext(WarApiManagerConfig config,
        @New DefaultSecurityContext defaultSC, @New KeycloakSecurityContext keycloakSC) {
    if ("default".equals(config.getSecurityContextType())) { //$NON-NLS-1$
        return defaultSC;
    } else if ("keycloak".equals(config.getSecurityContextType())) { //$NON-NLS-1$
        return keycloakSC;
    } else {
        throw new RuntimeException("Unknown security context type: " + config.getSecurityContextType()); //$NON-NLS-1$
    }
}
 
开发者ID:apiman,项目名称:apiman,代码行数:12,代码来源:WarCdiFactory.java


示例20: provideDataEncrypter

import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IDataEncrypter provideDataEncrypter(@New DefaultDataEncrypter defaultEncrypter,
        WarApiManagerConfig config, IPluginRegistry pluginRegistry) {
    try {
        IDataEncrypter encrypter = createCustomComponent(IDataEncrypter.class, config.getDataEncrypterType(),
                config.getDataEncrypterProperties(), pluginRegistry, defaultEncrypter);
        CurrentDataEncrypter.instance = encrypter;
        return encrypter;
    } catch (Throwable t) {
        throw new RuntimeException("Error or unknown data encrypter type: " + config.getDataEncrypterType(), t); //$NON-NLS-1$
    }
}
 
开发者ID:apiman,项目名称:apiman,代码行数:13,代码来源:WarCdiFactory.java



注:本文中的javax.enterprise.inject.New类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CoreWebRoutable类代码示例发布时间:2022-05-21
下一篇:
Java TitanManagement类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap