List of usage examples for org.springframework.core.env Environment getProperty
@Nullable String getProperty(String key);
From source file:org.jblogcms.core.config.SocialContext.java
@Override public void addConnectionFactories(ConnectionFactoryConfigurer connectionFactoryConfigurer, Environment environment) { connectionFactoryConfigurer.addConnectionFactory(new FacebookConnectionFactory( environment.getProperty("facebook.appId"), environment.getProperty("facebook.appSecret"))); connectionFactoryConfigurer.addConnectionFactory(new TwitterConnectionFactory( environment.getProperty("twitter.consumerKey"), environment.getProperty("twitter.consumerSecret"))); }
From source file:io.lavagna.config.PersistenceAndServiceConfig.java
@Bean public QueryFactory queryFactory(Environment env, NamedParameterJdbcTemplate jdbc) { return new QueryFactory(env.getProperty("datasource.dialect"), jdbc); }
From source file:io.pivotal.ecosystem.servicebroker.HelloConfig.java
@Bean public HelloBrokerRepository helloRepository(Environment env) { return Feign.builder().encoder(new GsonEncoder()).decoder(new GsonDecoder()).target( HelloBrokerRepository.class, "http://" + env.getProperty("HELLO_HOST") + ":" + env.getProperty("HELLO_PORT")); }
From source file:com.github.eddumelendez.autoconfigure.ldap.LdapProperties.java
private int determinePort(Environment environment) { if (environment != null) { String localPort = environment.getProperty("local.ldap.port"); if (localPort != null) { return Integer.valueOf(localPort); } else {//from w w w.j a va 2 s . c om return DEFAULT_PORT; } } throw new IllegalStateException("No local ldap port configuration is available"); }
From source file:rd.kpath.config.SocialConfig.java
@Bean public DisconnectController disconnectController(UsersConnectionRepository usersConnectionRepository, Environment environment) { return new DisconnectController(usersConnectionRepository, environment.getProperty("facebook.appSecret")); }
From source file:com.github.shredder121.gh_event_api.filter.GithubMACChecker.java
@Autowired public GithubMACChecker(Environment env) { String secret = env.getProperty("secret"); if (secret != null) { Key key = new SecretKeySpec(secret.getBytes(UTF_8), HMAC_SHA1); this.macProvider = new MacProvider(key); } else {/* w w w .j a va 2s . com*/ this.macProvider = null; } }
From source file:io.fabric8.quickstarts.camel.infinispan.InfinispanAutoConfiguration.java
/** * Defines a bean named 'remoteCacheContainer' that points to the remote Infinispan cluster. */// ww w. j ava 2s . c o m @Bean(initMethod = "start", destroyMethod = "stop") public BasicCacheContainer remoteCacheContainer(Environment environment) { String serviceBaseName = service.toUpperCase().replace("-", "_"); String host = environment.getProperty(serviceBaseName + "_SERVICE_HOST"); String port = environment.getProperty(serviceBaseName + "_SERVICE_PORT"); Objects.requireNonNull(host, "Infinispan service host not found in the environment"); Objects.requireNonNull(port, "Infinispan service port not found in the environment"); String hostPort = host + ":" + port; logger.info("Connecting to the Infinispan service at {}", hostPort); ConfigurationBuilder builder = new ConfigurationBuilder().forceReturnValues(true).addServers(hostPort); return new RemoteCacheManager(builder.create(), false); }
From source file:ch.sdi.core.impl.data.converter.ConverterDate.java
/** * @see ch.sdi.core.intf.FieldConverter#init(org.springframework.core.env.Environment, java.lang.String) *//*from w w w . j av a2 s . c o m*/ @Override public ConverterDate init(Environment aEnv, String aFieldname) throws SdiException { String pattern = aEnv.getProperty( SdiMainProperties.KEY_PREFIX_CONVERTER + CONVERTER_NAME + "." + aFieldname + PATTERN_SUFFIX); if (!StringUtils.hasText(pattern)) { myLog.trace("No pattern found for field " + aFieldname + ". Looking for a generic pattern"); pattern = aEnv.getProperty(SdiMainProperties.KEY_PREFIX_CONVERTER + CONVERTER_NAME + PATTERN_SUFFIX); } // if !StringUtils.hasText( pattern ) pattern = pattern.trim(); myLog.debug("found pattern for ConverterDate: " + pattern); setDatePattern(pattern); return this; }
From source file:io.bitsquare.app.BitsquareEnvironmentTests.java
@Test public void bitsquareVersionShouldBeAvailable() { // we cannot actually test for the value because (a) it requires Gradle's // processResources task filtering (which does not happen within IDEA) and // (b) because we do not know the specific version to test for. Instead just // test that the property has been made available. Environment env = new BitsquareEnvironment(new MockPropertySource()); assertThat(env.containsProperty(APP_VERSION_KEY), is(true)); assertThat(env.getProperty(UserAgent.VERSION_KEY), equalTo(env.getProperty(APP_VERSION_KEY))); }
From source file:ro.teamnet.hero.config.SocialConfig.java
@Bean public DisconnectController disconnectController(UsersConnectionRepository usersConnectionRepository, Environment env) { return new DisconnectController(usersConnectionRepository, env.getProperty("facebook.clientSecret")); }