List of usage examples for org.springframework.core.env Environment getProperty
@Nullable String getProperty(String key);
From source file:com.pepeshka.logreg.facebook.config.SocialConfig.java
@Override public void addConnectionFactories(ConnectionFactoryConfigurer cfConfig, Environment env) { cfConfig.addConnectionFactory(new FacebookConnectionFactory(env.getProperty("facebook.appKey"), env.getProperty("facebook.appSecret"))); }
From source file:com.greglturnquist.spring.social.ecobee.SocialConfig.java
@Bean public EcobeeConnectionFactory ecobeeConnectionFactory(ConnectionFactoryRegistry registry, Environment env) { final EcobeeConnectionFactory ecobeeConnectionFactory = new EcobeeConnectionFactory( env.getProperty("ecobee.apiKey")); registry.addConnectionFactory(ecobeeConnectionFactory); return ecobeeConnectionFactory; }
From source file:com.mycompany.spring.context.demo.MessagePrinter.java
@Autowired public MessagePrinter(ApplicationContext context, Environment environment) { //service = context.getBean(MessageService.class); // NoUniqueBeanDefinitionException service = context.getBean(environment.getProperty("messageService"), MessageService.class); }
From source file:com.lixiaocong.social.SocialConfig.java
@Override public void addConnectionFactories(ConnectionFactoryConfigurer cfConfig, Environment env) { cfConfig.addConnectionFactory(/* ww w.j av a 2s .c o m*/ new QQConnectionFactory(env.getProperty("qq.id"), env.getProperty("qq.secret"))); cfConfig.addConnectionFactory( new FacebookConnectionFactory(env.getProperty("facebook.id"), env.getProperty("facebook.secret"))); }
From source file:com.payu.ratel.config.beans.RegistryBeanProviderFactory.java
public RegistryStrategiesProvider create(ConfigurableListableBeanFactory beanFactory) { final Environment environment = beanFactory.getBean(Environment.class); if ("false".equals(environment.getProperty(RatelContextApplier.SERVICE_DISCOVERY_ENABLED))) { LOGGER.info("Ratel is disabled"); return null; }// w w w . j a va 2 s . c o m LOGGER.info("Ratel is enabled"); RegistryStrategiesProvider registryBeanProvider; try { registryBeanProvider = beanFactory.getBean(RegistryStrategiesProvider.class); LOGGER.info("Ratel was already configured, skiping second initialization"); } catch (NoSuchBeanDefinitionException e) { registryBeanProvider = createAndRegisterStrategiesProvider(beanFactory); LOGGER.info("Ratel is configured"); } return registryBeanProvider; }
From source file:com.jiwhiz.web.config.SocialConfig.java
@Override public void addConnectionFactories(ConnectionFactoryConfigurer configurer, Environment environment) { configurer.addConnectionFactory(/*from ww w. ja v a2s. co m*/ new GoogleConnectionFactory(environment.getProperty("spring.social.google.appId"), environment.getProperty("spring.social.google.appSecret"))); }
From source file:com.payu.ratel.config.beans.ZookeeperRegistryBeanProvider.java
@SuppressWarnings("PMD.AvoidCatchingGenericException") private void configure() { System.setProperty("zookeeper.sasl.client", "false"); Environment env = beanFactory.getBean(Environment.class); String zkHostAddress = env.getProperty(RegistryBeanProviderFactory.SERVICE_DISCOVERY_ZK_HOST); this.curatorFramework = CuratorFrameworkFactory.newClient(zkHostAddress, new ExponentialBackoffRetry(1000, 3)); curatorFramework.start();/*from www .ja v a 2 s . c o m*/ this.serviceDiscovery = ServiceDiscoveryBuilder.builder(Void.class).client(this.curatorFramework) .basePath("/services").build(); try { getServiceDiscovery().start(); } catch (Exception e) { throw new IllegalStateException("Service discovery start failed.", e); } this.zookeeperRegistry = new ZookeeperRegistry(getServiceDiscovery()); this.zookeeperFetcher = new ZookeeperFetcher(getServiceDiscovery()); this.zookeeperProxyGenerator = new ZookeeperProxyGenerator(beanFactory); }
From source file:com.otz.transport.consumer.config.TransportConfiguration.java
@Bean(name = "KafkaProperties") public Properties kafkaProperties(Environment environment) { String kafkaServer = environment.getProperty(environment.getActiveProfiles()[0] + KAFKA); Properties properties = new Properties(); properties.put(GROUP_ID, environment.getProperty(TRANSPORT_KAFKA_GROUP_ID)); properties.put(ENABLE_AUTO_COMMIT, environment.getProperty(TRANSPORT_KAFKA_ENABLE_AUTO_COMMIT)); properties.put(AUTO_COMMIT_INTERVAL_MS, environment.getProperty(TRANSPORT_KAFKA_AUTO_COMMIT_INTERVAL_MS)); properties.put(SESSION_TIMEOUT_MS, environment.getProperty(TRANSPORT_KAFKA_SESSION_TIMEOUT_MS)); properties.put(KEY_DESERIALIZER, environment.getProperty(TRANSPORT_KAFKA_KEY_DESERIALIZER)); properties.put(VALUE_DESERIALIZER, environment.getProperty(TRANSPORT_KAFKA_VALUE_DESERIALIZER)); properties.put(KEY_SERIALIZER, environment.getProperty(TRANSPORT_KAFKA_KEY_SERIALIZER)); properties.put(VALUE_SERIALIZER, environment.getProperty(TRANSPORT_KAFKA_VALUE_SERIALIZER)); properties.put(BOOTSTRAP_SERVERS, kafkaServer); return properties; }
From source file:com.folion.config.SocialConfiguration.java
@Bean public DisconnectController disconnectController(UsersConnectionRepository usersConnectionRepository, Environment env) { return new DisconnectController(usersConnectionRepository, env.getProperty("facebook.appSecret")); }
From source file:com.yj.config.SocialConfig.java
@Override public void addConnectionFactories(ConnectionFactoryConfigurer cfConfig, Environment env) { cfConfig.addConnectionFactory(//from w w w .j av a2 s .c om new GoogleConnectionFactory(env.getProperty("google.appKey"), env.getProperty("google.appSecret"))); }