org.springframework.context.annotation.Profile Java Examples

The following examples show how to use org.springframework.context.annotation.Profile. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CalendarApplication.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@Profile("trace")
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    return args -> {

        System.out.println("Let's inspect the beans provided by Spring Boot:\n");

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            System.out.println(beanName);
        }

        System.out.println("---");
    };
}
 
Example #2
Source File: CalendarApplication.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@Profile("trace")
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    return args -> {

        System.out.println("Let's inspect the beans provided by Spring Boot:\n");

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            System.out.println(beanName);
        }

        System.out.println("---");
    };
}
 
Example #3
Source File: CalendarApplication.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@Profile("trace")
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    return args -> {

        System.out.println("Let's inspect the beans provided by Spring Boot:\n");

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            System.out.println(beanName);
        }

        System.out.println("---");
    };
}
 
Example #4
Source File: CommonBeans.java    From circus-train with Apache License 2.0 6 votes vote down vote up
@Profile({ Modules.REPLICATION })
@Bean
Supplier<CloseableMetaStoreClient> replicaMetaStoreClientSupplier(
    ReplicaCatalog replicaCatalog,
    @Value("#{replicaHiveConf}") HiveConf replicaHiveConf,
    ConditionalMetaStoreClientFactoryManager conditionalMetaStoreClientFactoryManager) {
  String metaStoreUris = replicaCatalog.getHiveMetastoreUris();
  if (metaStoreUris == null) {
    // Default to Thrift is not specified - optional attribute in ReplicaCatalog
    metaStoreUris = ThriftHiveMetaStoreClientFactory.ACCEPT_PREFIX;
  }
  MetaStoreClientFactory replicaMetaStoreClientFactory = conditionalMetaStoreClientFactoryManager
      .factoryForUri(metaStoreUris);
  return metaStoreClientSupplier(replicaHiveConf, replicaCatalog.getName(), replicaCatalog.getMetastoreTunnel(),
      replicaMetaStoreClientFactory);
}
 
Example #5
Source File: CommonBeans.java    From circus-train with Apache License 2.0 6 votes vote down vote up
@Profile({ Modules.REPLICATION })
@Bean
Supplier<CloseableMetaStoreClient> sourceMetaStoreClientSupplier(
    SourceCatalog sourceCatalog,
    @Value("#{sourceHiveConf}") HiveConf sourceHiveConf,
    ConditionalMetaStoreClientFactoryManager conditionalMetaStoreClientFactoryManager) {
  String metaStoreUris = sourceCatalog.getHiveMetastoreUris();
  if (metaStoreUris == null) {
    // Default to Thrift is not specified - optional attribute in SourceCatalog
    metaStoreUris = ThriftHiveMetaStoreClientFactory.ACCEPT_PREFIX;
  }
  MetaStoreClientFactory sourceMetaStoreClientFactory = conditionalMetaStoreClientFactoryManager
      .factoryForUri(metaStoreUris);
  return metaStoreClientSupplier(sourceHiveConf, sourceCatalog.getName(), sourceCatalog.getMetastoreTunnel(),
      sourceMetaStoreClientFactory);
}
 
Example #6
Source File: FileWriterIntegrationConfig.java    From spring-in-action-5-samples with Apache License 2.0 6 votes vote down vote up
@Profile("javaconfig")
@Bean
@Transformer(inputChannel="textInChannel",
             outputChannel="fileWriterChannel")
public GenericTransformer<String, String> upperCaseTransformer() {
  return text -> text.toUpperCase();
}
 
Example #7
Source File: CalendarApplication.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@Profile("trace")
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    return args -> {

        System.out.println("Let's inspect the beans provided by Spring Boot:\n");

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            System.out.println(beanName);
        }

        System.out.println("---");
    };
}
 
Example #8
Source File: SkipperServerPlatformConfiguration.java    From spring-cloud-skipper with Apache License 2.0 6 votes vote down vote up
@Bean
@Profile("local")
public Platform localDeployers(LocalPlatformProperties localPlatformProperties) {
	List<Deployer> deployers = new ArrayList<>();
	Map<String, LocalDeployerProperties> localDeployerPropertiesMap = localPlatformProperties.getAccounts();
	if (localDeployerPropertiesMap.isEmpty()) {
		localDeployerPropertiesMap.put("default", new LocalDeployerProperties());
	}
	for (Map.Entry<String, LocalDeployerProperties> entry : localDeployerPropertiesMap
			.entrySet()) {
		LocalAppDeployer localAppDeployer = new LocalAppDeployer(entry.getValue());
		Deployer deployer = new Deployer(entry.getKey(), "local", localAppDeployer);
		deployer.setDescription(prettyPrintLocalDeployerProperties(entry.getValue()));
		deployers.add(deployer);
	}

	return new Platform("Local", deployers);
}
 
Example #9
Source File: CalendarApplication.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@Profile("trace")
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    return args -> {

        System.out.println("Let's inspect the beans provided by Spring Boot:\n");

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            System.out.println(beanName);
        }

        System.out.println("---");
    };
}
 
Example #10
Source File: CalendarApplication.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@Profile("trace")
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    return args -> {

        System.out.println("Let's inspect the beans provided by Spring Boot:\n");

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            System.out.println(beanName);
        }

        System.out.println("---");
    };
}
 
Example #11
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}
 
Example #12
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}
 
Example #13
Source File: CatalogueConfiguration.java    From library with MIT License 5 votes vote down vote up
@Profile("local")
@Bean
CommandLineRunner init(Catalogue catalogue) {
    return args -> {
        catalogue.addBook("Joshua Bloch", "Effective Java", "0321125215").get();
        catalogue.addBookInstance("0321125215", BookType.Restricted).get();
    };
}
 
Example #14
Source File: Application.java    From kafka-with-springboot with Apache License 2.0 5 votes vote down vote up
@Bean
@Profile("!test")
public CommandLineRunner batchMessageConsumerRunner() {
    return args -> {
        //Just comment out the examples to run
        //simpleKafkaMessagingExample.execute();
        //multiPartitionMessagingExample.execute();
        //batchMessageConsumingExample.execute();
        //kafkaStreamExample.execute();
    };
}
 
Example #15
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}
 
Example #16
Source File: SpringBootApacheGeodeLocatorApplication.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
@Bean
@Profile("locator-configurer")
LocatorConfigurer clusterLocatorConfigurer(
	@Value("${spring.data.gemfire.locators:localhost[10334]}") String locators) {

	return (beanName, bean) -> bean.getGemFireProperties()
		.setProperty(GemFireProperties.LOCATORS.toString(), locators);
}
 
Example #17
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}
 
Example #18
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}
 
Example #19
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}
 
Example #20
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}
 
Example #21
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}
 
Example #22
Source File: DatabaseConfiguration.java    From okta-jhipster-microservices-oauth-example with Apache License 2.0 5 votes vote down vote up
/**
 * Open the TCP port for the H2 database, so it is available remotely.
 *
 * @return the H2 database TCP server
 * @throws SQLException if the server failed to start
 */
@Bean(initMethod = "start", destroyMethod = "stop")
@Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)
public Object h2TCPServer() throws SQLException {
    log.debug("Starting H2 database");
    return H2ConfigurationHelper.createServer();
}
 
Example #23
Source File: CircusTrain.java    From circus-train with Apache License 2.0 5 votes vote down vote up
@Profile({ Modules.REPLICATION })
@Bean
PartitionTransformation partitionTransformation(List<PartitionTransformation> transformations) {
  if (transformations == null) {
    transformations = Collections.emptyList();
  }
  return new CompositePartitionTransformation(transformations);
}
 
Example #24
Source File: InceptionSecurity.java    From inception with Apache License 2.0 5 votes vote down vote up
@Bean(name = "authenticationProvider")
@Profile("auto-mode-preauth")
public PreAuthenticatedAuthenticationProvider externalAuthenticationProvider()
{
    PreAuthenticatedAuthenticationProvider authProvider = 
            new PreAuthenticatedAuthenticationProvider();
    authProvider.setPreAuthenticatedUserDetailsService(
            new UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken>(
                    userDetailsService()));
    return authProvider;
}
 
Example #25
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}
 
Example #26
Source File: AccountServiceApplication.java    From microservices-event-sourcing with Apache License 2.0 5 votes vote down vote up
@Bean
@Profile("dev")
CommandLineRunner commandLineRunner(DatabaseInitializer databaseInitializer) {
    return args -> {
        // Initialize the database for end to end integration testing
        databaseInitializer.populate();
    };
}
 
Example #27
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}
 
Example #28
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}
 
Example #29
Source File: DatabaseConfiguration.java    From airsonic with GNU General Public License v3.0 5 votes vote down vote up
@Bean
@Profile("legacy")
public DataSource legacyDataSource() {
    BasicDataSource dataSource = new BasicDataSource();
    dataSource.setDriverClassName("org.hsqldb.jdbcDriver");
    dataSource.setUrl(SettingsService.getDefaultJDBCUrl());
    dataSource.setUsername(SettingsService.getDefaultJDBCUsername());
    dataSource.setPassword(SettingsService.getDefaultJDBCPassword());
    return dataSource;
}
 
Example #30
Source File: Application.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
    return httpServer.handle(adapter);
}