@Override public boolean isActive(Environment environment) { return environment.containsProperty("VCAP_APPLICATION") || environment.containsProperty("VCAP_SERVICES"); }
@Override public boolean isActive(Environment environment) { return environment.containsProperty("HC_LANDSCAPE"); }
@Override public boolean isActive(Environment environment) { return environment.containsProperty("DYNO"); }
private void setDubboApplicationNameProperty(Environment environment, Map<String, Object> defaultProperties) { String springApplicationName = environment.getProperty(SPRING_APPLICATION_NAME_PROPERTY); if (StringUtils.hasLength(springApplicationName) && !environment.containsProperty(DUBBO_APPLICATION_NAME_PROPERTY)) { defaultProperties.put(DUBBO_APPLICATION_NAME_PROPERTY, springApplicationName); } }
public RoutePredicateHandlerMapping(FilteringWebHandler webHandler, RouteLocator routeLocator, GlobalCorsProperties globalCorsProperties, Environment environment) { this.webHandler = webHandler; this.routeLocator = routeLocator; if (environment.containsProperty("management.server.port")) { managmentPort = new Integer(environment.getProperty("management.server.port")); } else { managmentPort = null; } setOrder(1); setCorsConfigurations(globalCorsProperties.getCorsConfigurations()); }
public ConfigClientProperties override( org.springframework.core.env.Environment environment) { ConfigClientProperties override = new ConfigClientProperties(); BeanUtils.copyProperties(this, override); override.setName( environment.resolvePlaceholders("${" + ConfigClientProperties.PREFIX + ".name:${spring.application.name:application}}")); if (environment.containsProperty(ConfigClientProperties.PREFIX + ".profile")) { override.setProfile( environment.getProperty(ConfigClientProperties.PREFIX + ".profile")); } if (environment.containsProperty(ConfigClientProperties.PREFIX + ".label")) { override.setLabel( environment.getProperty(ConfigClientProperties.PREFIX + ".label")); } return override; }
if (environment != null && environment.containsProperty(name)) { Object value = environment.getProperty(name, Object.class); logger.debug("From Environment: " + name);
private Endpoint.Builder addAddress(Endpoint.Builder builder) { if (this.serverProperties != null && this.serverProperties.getAddress() != null && builder.parseIp(this.serverProperties.getAddress())) { return builder; } else if (this.environment.containsProperty(IP_ADDRESS_PROP_NAME) && builder.parseIp(this.environment.getProperty(IP_ADDRESS_PROP_NAME, String.class))) { return builder; } else { return builder.ip(this.firstNonLoopbackAddress); } }
private boolean isRemoteRestartEnabled(Environment environment) { return environment.containsProperty("spring.devtools.remote.secret"); }
protected void setPcapOptions(String username, PcapRequest pcapRequest) throws IOException { PcapOptions.JOB_NAME.put(pcapRequest, "jobName"); PcapOptions.USERNAME.put(pcapRequest, username); Configuration hadoopConf = new Configuration(configuration); if (environment.containsProperty(PCAP_YARN_QUEUE_SPRING_PROPERTY)) { String queue = environment.getProperty(PCAP_YARN_QUEUE_SPRING_PROPERTY); if (queue != null && !queue.isEmpty()) { hadoopConf.set(MRJobConfig.QUEUE_NAME, environment.getProperty(PCAP_YARN_QUEUE_SPRING_PROPERTY)); } } PcapOptions.HADOOP_CONF.put(pcapRequest, hadoopConf); PcapOptions.FILESYSTEM.put(pcapRequest, getFileSystem()); if (pcapRequest.getBasePath() == null) { pcapRequest.setBasePath(environment.getProperty(MetronRestConstants.PCAP_BASE_PATH_SPRING_PROPERTY)); } if (pcapRequest.getBaseInterimResultPath() == null) { pcapRequest.setBaseInterimResultPath(environment.getProperty(MetronRestConstants.PCAP_BASE_INTERIM_RESULT_PATH_SPRING_PROPERTY)); } if (pcapRequest.getFinalOutputPath() == null) { pcapRequest.setFinalOutputPath(environment.getProperty(MetronRestConstants.PCAP_FINAL_OUTPUT_PATH_SPRING_PROPERTY)); } PcapOptions.NUM_RECORDS_PER_FILE.put(pcapRequest, Integer.parseInt(environment.getProperty(MetronRestConstants.PCAP_PAGE_SIZE_SPRING_PROPERTY))); PcapOptions.FINALIZER_THREADPOOL_SIZE.put(pcapRequest, environment.getProperty(MetronRestConstants.PCAP_FINALIZER_THREADPOOL_SIZE_SPRING_PROPERTY)); }
private void validateRequest() { Assert.isTrue(environment.containsProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_JOB_EXECUTION_ID), "A job execution id is required"); Assert.isTrue(environment.containsProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_EXECUTION_ID), "A step execution id is required"); Assert.isTrue(environment.containsProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_NAME), "A step name is required"); Assert.isTrue(this.stepLocator.getStepNames().contains(environment.getProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_NAME)), "The step requested cannot be found in the provided BeanFactory"); } }
public <T> T lookup(Class<?> type, String name) { String functionDefinitionName = !StringUtils.hasText(name) && environment.containsProperty("spring.cloud.function.definition") ? environment.getProperty("spring.cloud.function.definition") : name; return this.doLookup(type, functionDefinitionName); }
public String load(String propertyName) { ApplicationContext context = new AnnotationConfigApplicationContext("my.pack.offer.*"); Environment e = context.getEnvironment(); boolean a = e.containsProperty(propertyName); return e.getRequiredProperty(propertyName); }
@Override public boolean containsProperty(String key) { Assert.noBlanks(key); return env.containsProperty(key); }
public String getEnabledIpRange() { if (environment.containsProperty(SofaOptions.CONFIG_IP_RANGE)) { return environment.getProperty(SofaOptions.CONFIG_IP_RANGE); } return StringUtils.isEmpty(enabledIpRange) ? getDotString(new Object() { }.getClass().getEnclosingMethod().getName()) : enabledIpRange; }
public String getBoltThreadPoolCoreSize() { if (environment.containsProperty(SofaOptions.TR_MIN_POOLSIZE)) { return environment.getProperty(SofaOptions.TR_MIN_POOLSIZE); } return StringUtils.isEmpty(boltThreadPoolCoreSize) ? getDotString(new Object() { }.getClass().getEnclosingMethod().getName()) : boltThreadPoolCoreSize; }
public String getBindNetworkInterface() { if (environment.containsProperty(SofaOptions.CONFIG_NI_BIND)) { return environment.getProperty(SofaOptions.CONFIG_NI_BIND); } return StringUtils.isEmpty(bindNetworkInterface) ? getDotString(new Object() { }.getClass().getEnclosingMethod().getName()) : bindNetworkInterface; }
protected List<String> arrayOfPropertyNamesFor(String propertyNamePrefix, String propertyNameSuffix) { List<String> propertyNames = new ArrayList<>(); boolean found = true; for (int index = 0; (found && index < Integer.MAX_VALUE); index++) { String propertyName = asArrayProperty(propertyNamePrefix, index, propertyNameSuffix); found = getEnvironment().containsProperty(propertyName); if (found) { propertyNames.add(propertyName); } } return propertyNames; }
@Override public boolean containsProperty(String key) { Assert.noBlanks(key); return context.getEnv().containsProperty(key); }
@Test public void shouldContainProperty() { assertThat(environment.containsProperty("vault.value")).isTrue(); assertThat(environment.getProperty("vault.value")).isEqualTo("foo"); assertThat(environment.containsProperty("nested.key")).isTrue(); assertThat(environment.getProperty("nested.key")).isEqualTo("value"); }