Search in sources :

Example 1 with Profile

use of org.springframework.context.annotation.Profile in project tutorials by eugenp.

the class H2TestProfileJPAConfig method dataSource.

@Bean
@Profile("test")
public DataSource dataSource() {
    final DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("org.h2.Driver");
    dataSource.setUrl("jdbc:h2:mem:db;DB_CLOSE_DELAY=-1");
    dataSource.setUsername("sa");
    dataSource.setPassword("sa");
    return dataSource;
}
Also used : DriverManagerDataSource(org.springframework.jdbc.datasource.DriverManagerDataSource) Profile(org.springframework.context.annotation.Profile) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 2 with Profile

use of org.springframework.context.annotation.Profile in project nakadi by zalando.

the class RepositoriesConfig method featureToggleServiceLocal.

@Profile({ "acceptanceTest", "local" })
@Bean
public FeatureToggleService featureToggleServiceLocal(final ZooKeeperHolder zooKeeperHolder, final FeaturesConfig featuresConfig) {
    final FeatureToggleService featureToggleService = new FeatureToggleServiceZk(zooKeeperHolder);
    if (featuresConfig.containsDefaults()) {
        final Set<String> features = featuresConfig.getFeaturesWithDefaultState();
        for (final String feature : features) {
            LOG.info("Setting feature {} to {}", feature, featuresConfig.getDefaultState(feature));
            featureToggleService.setFeature(new FeatureToggleService.FeatureWrapper(FeatureToggleService.Feature.valueOf(feature), featuresConfig.getDefaultState(feature)));
        }
    }
    return featureToggleService;
}
Also used : FeatureToggleServiceZk(org.zalando.nakadi.service.FeatureToggleServiceZk) FeatureToggleService(org.zalando.nakadi.service.FeatureToggleService) Profile(org.springframework.context.annotation.Profile) Bean(org.springframework.context.annotation.Bean)

Example 3 with Profile

use of org.springframework.context.annotation.Profile in project pivotal-cla by pivotalsoftware.

the class SessionConfig method cloudRedisConnectionFactory.

@Profile(GitHubClaProfiles.CLOUDFOUNDRY)
@Bean
public RedisConnectionFactory cloudRedisConnectionFactory() {
    CloudFactory cloudFactory = new CloudFactory();
    Cloud cloud = cloudFactory.getCloud();
    RedisConnectionFactory connectionFactory = cloud.getSingletonServiceConnector(RedisConnectionFactory.class, null);
    if (connectionFactory instanceof LettuceConnectionFactory) {
        ((LettuceConnectionFactory) connectionFactory).setShutdownTimeout(0);
    }
    return connectionFactory;
}
Also used : CloudFactory(org.springframework.cloud.CloudFactory) Cloud(org.springframework.cloud.Cloud) LettuceConnectionFactory(org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory) RedisConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory) Profile(org.springframework.context.annotation.Profile) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with Profile

use of org.springframework.context.annotation.Profile in project alien4cloud by alien4cloud.

the class SecurityConfiguration method demoAuthenticationProvider.

@Bean
@Profile("security-demo")
public DaoAuthenticationProvider demoAuthenticationProvider() {
    log.warn("ALIEN 4 CLOUD is Running in DEMO mode. This includes demo users and MUST NOT BE USED in PRODUCTION");
    DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
    List<UserDetails> users = getUsers(new String[] { "user", "componentManager", "componentBrowser", "applicationManager", "appManager", "admin", "architect" }, new String[] { "COMPONENTS_BROWSER", "COMPONENTS_BROWSER, COMPONENTS_MANAGER", "COMPONENTS_BROWSER", "APPLICATIONS_MANAGER, COMPONENTS_BROWSER, COMPONENTS_MANAGER", "APPLICATIONS_MANAGER, COMPONENTS_BROWSER, COMPONENTS_MANAGER", "ADMIN", "ARCHITECT, COMPONENTS_BROWSER" });
    InMemoryUserDetailsManager detailsManager = new InMemoryUserDetailsManager(users);
    provider.setUserDetailsService(detailsManager);
    return provider;
}
Also used : UserDetails(org.springframework.security.core.userdetails.UserDetails) DaoAuthenticationProvider(org.springframework.security.authentication.dao.DaoAuthenticationProvider) InMemoryUserDetailsManager(org.springframework.security.provisioning.InMemoryUserDetailsManager) Profile(org.springframework.context.annotation.Profile) Bean(org.springframework.context.annotation.Bean)

Example 5 with Profile

use of org.springframework.context.annotation.Profile in project av-service by dvoraka.

the class CoreConfig method mbeanExporter.

/**
 * Special MBeanExporter bean for integration tests.
 *
 * @return MBeanExporter with a different registration strategy
 */
@Bean
@Profile("itest")
public MBeanExporter mbeanExporter() {
    MBeanExporter exporter = new MBeanExporter();
    exporter.setRegistrationPolicy(RegistrationPolicy.REPLACE_EXISTING);
    return exporter;
}
Also used : MBeanExporter(org.springframework.jmx.export.MBeanExporter) Profile(org.springframework.context.annotation.Profile) Bean(org.springframework.context.annotation.Bean)

Aggregations

Bean (org.springframework.context.annotation.Bean)23 Profile (org.springframework.context.annotation.Profile)23 ObjectFactoryCreatingFactoryBean (org.springframework.beans.factory.config.ObjectFactoryCreatingFactoryBean)5 ArrayList (java.util.ArrayList)2 ConfigurationProperties (org.springframework.boot.context.properties.ConfigurationProperties)2 Scope (org.springframework.context.annotation.Scope)2 ExternalConfiguration (alfio.manager.system.ExternalConfiguration)1 ReportPortalRepositoryFactoryBean (com.epam.ta.reportportal.database.dao.ReportPortalRepositoryFactoryBean)1 RepositoriesFactoryBean (com.epam.ta.reportportal.database.support.RepositoriesFactoryBean)1 JcrIndexService (com.thinkbiganalytics.metadata.modeshape.service.JcrIndexService)1 SimpleServiceLevelAssessor (com.thinkbiganalytics.metadata.sla.spi.core.SimpleServiceLevelAssessor)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 SQLException (java.sql.SQLException)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 RepositoryException (javax.jcr.RepositoryException)1 ObservationManager (javax.jcr.observation.ObservationManager)1 MessagingKafkaConsumerConfigProperties (org.eclipse.hono.client.kafka.consumer.MessagingKafkaConsumerConfigProperties)1 MessagingKafkaProducerConfigProperties (org.eclipse.hono.client.kafka.producer.MessagingKafkaProducerConfigProperties)1 ProtonBasedNotificationSender (org.eclipse.hono.client.notification.amqp.ProtonBasedNotificationSender)1