io.micronaut.context.annotation.Factory类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(153)

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

Factory介绍

暂无

代码示例

代码示例来源:origin: micronaut-projects/micronaut-core

@Factory
public class ServiceHttpClientFactory {

代码示例来源:origin: micronaut-projects/micronaut-core

@Factory
public class NettyThreadFactory {

代码示例来源:origin: micronaut-projects/micronaut-core

@Factory
public class TypeConverters {

  @Bean
  @Singleton
  public TypeConverter<String, Bar> stringToBarConverter() {
    return TypeConverter.of(
        String.class,
        Bar.class,
        Bar::new
    );
  }

  @Bean
  @Singleton
  public TypeConverter<String, Foo> stringToFooConverter() {
    return TypeConverter.of(
        String.class,
        Foo.class,
        Foo::new
    );
  }

}

代码示例来源:origin: micronaut-projects/micronaut-core

@Factory
@Requires(beans = AWSLambdaConfiguration.class)
public class AWSLambdaAsyncClientFactory {

代码示例来源:origin: micronaut-projects/micronaut-core

@Factory
public class TestFunctionFactory {

代码示例来源:origin: micronaut-projects/micronaut-core

@Factory
@Internal
public class ByteBufConverters {

代码示例来源:origin: micronaut-projects/micronaut-core

@Factory
public class TestFunctionFactory {

代码示例来源:origin: micronaut-projects/micronaut-core

@Factory
@BootstrapContextCompatible
public class ResourceLoaderFactory {

代码示例来源:origin: io.micronaut/runtime

/**
 * A bean for the default {@link MediaTypeCodecRegistry} used by the server.
 *
 * @author Graeme Rocher
 * @since 1.0
 */
@Factory
public class MediaTypeCodecRegistryFactory {

  /**
   * @param codecs List of codecs for media types
   * @return A bean for default codecs registry
   */
  @Singleton
  @Primary
  @Bean
  MediaTypeCodecRegistry mediaTypeCodecRegistry(List<MediaTypeCodec> codecs) {
    return MediaTypeCodecRegistry.of(codecs);
  }
}

代码示例来源:origin: io.micronaut/runtime

/**
 * The default thread factory used for creating threads in Micronaut.
 *
 * @author graemerocher
 * @since 1.0
 */
@Factory
public class DefaultThreadFactory {

  /**
   * @return The default thread factory
   */
  @Bean
  @Singleton
  @Primary
  ThreadFactory threadFactory() {
    return Executors.defaultThreadFactory();
  }
}

代码示例来源:origin: org.ctoolkit.agent/ctoolkit-agent-core

/**
 * Converter registrat factory provides map of {@link Agent} to {@link ConverterRegistrat} mapping
 * @author <a href="mailto:pohorelec@turnonlie.biz">Jozef Pohorelec</a>
 */
@Factory
public class RegistratFactory
{
  @Bean
  @Singleton
  public Map<Agent, BaseConverterRegistrat> provideRegistrats(
      ElasticsearchConverterRegistrat elasticsearchConverterRegistrat,
      MongoConverterRegistrat mongoConverterRegistrat
  )
  {
    Map<Agent, BaseConverterRegistrat> registrats = new HashMap<>(  );
    registrats.put( Agent.ELASTICSEARCH, elasticsearchConverterRegistrat );
    registrats.put( Agent.MONGO, mongoConverterRegistrat );
    return registrats;
  }
}

代码示例来源:origin: io.micronaut/runtime

@Factory
public class ExecutorFactory {

代码示例来源:origin: io.micronaut/http-client

@Factory
public class ServiceHttpClientFactory {

代码示例来源:origin: io.micronaut/micronaut-http-client

@Factory
public class ServiceHttpClientFactory {

代码示例来源:origin: io.micronaut/runtime

/**
 * Configures the default I/O thread pool if none is configured by the user.
 *
 * @author Graeme Rocher
 * @since 1.0
 */
@Requires(missingProperty = ExecutorConfiguration.PREFIX_IO)
@Factory
public class IOExecutorServiceConfig {

  /**
   * @return The default thread pool configurations
   */
  @Singleton
  @Bean
  @Named(TaskExecutors.IO)
  ExecutorConfiguration configuration() {
    return UserExecutorConfiguration.of(ExecutorType.CACHED);
  }
}

代码示例来源:origin: io.micronaut/runtime

/**
 * A default executor service for scheduling adhoc tasks via
 * {@link java.util.concurrent.ScheduledExecutorService}.
 *
 * @author Graeme Rocher
 * @since 1.0
 */
@Requires(missingProperty = ExecutorConfiguration.PREFIX_SCHEDULED)
@Factory
public class ScheduledExecutorServiceConfig {

  /**
   * @return The executor configurations
   */
  @Singleton
  @Bean
  @Named(TaskExecutors.SCHEDULED)
  ExecutorConfiguration configuration() {
    return UserExecutorConfiguration.of(ExecutorType.SCHEDULED);
  }
}

代码示例来源:origin: io.micronaut/micronaut-http

@Factory
@BootstrapContextCompatible
public class ResourceLoaderFactory {

代码示例来源:origin: io.micronaut/runtime

@Factory
public class ObjectMapperFactory {

代码示例来源:origin: io.micronaut.configuration/micronaut-hibernate-validator

@Factory
public class ValidatorFactoryProvider {

代码示例来源:origin: io.micronaut/spring

@Factory
@Requires(classes = DataSourceTransactionManager.class)
@Requires(condition = HibernatePresenceCondition.class)

相关文章

Factory类方法