Codota Logo
NativeEnvironmentRepository
Code IndexAdd Codota to your IDE (free)

How to use
NativeEnvironmentRepository
in
org.springframework.cloud.config.server.environment

Best Java code snippets using org.springframework.cloud.config.server.environment.NativeEnvironmentRepository (Showing top 11 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: spring-cloud/spring-cloud-config

  @Override
  public NativeEnvironmentRepository build(NativeEnvironmentProperties environmentProperties) {
    NativeEnvironmentRepository repository = new NativeEnvironmentRepository(environment, environmentProperties);
    if(properties.getDefaultLabel() != null) {
      repository.setDefaultLabel(properties.getDefaultLabel());
    }
    return repository;
  }
}
origin: spring-cloud/spring-cloud-config

private String[] getArgs(String application, String profile, String label) {
  List<String> list = new ArrayList<String>();
  String config = application;
  if (!config.startsWith("application")) {
    config = "application," + config;
  }
  list.add("--spring.config.name=" + config);
  list.add("--spring.cloud.bootstrap.enabled=false");
  list.add("--encrypt.failOnError=" + this.failOnError);
  list.add("--spring.config.location=" + StringUtils.arrayToCommaDelimitedString(
      getLocations(application, profile, label).getLocations()));
  return list.toArray(new String[0]);
}
origin: spring-cloud/spring-cloud-config

private Set<Path> getFileRepo() {
  if (this.scmRepository != null) {
    try {
      Resource resource = this.resourceLoader.getResource(this.scmRepository.getUri());
      if (resource instanceof FileSystemResource) {
        return Collections.singleton(Paths.get(resource.getURI()));
      }
    }
    catch (IOException e) {
      log.error("Cannot resolve URI for path: " + this.scmRepository.getUri());
    }
  }
  if (this.nativeEnvironmentRepository != null) {
    Set<Path> paths = new LinkedHashSet<>();
    for (String path : this.nativeEnvironmentRepository.getSearchLocations()) {
      Resource resource = this.resourceLoader.getResource(path);
      if (resource.exists()) {
        try {
          paths.add(Paths.get(resource.getURI()));
        }
        catch (Exception e) {
          log.error("Cannot resolve URI for path: " + path);
        }
      }
    }
    return paths;
  }
  return null;
}
origin: spring-cloud/spring-cloud-config

@Override
public synchronized Environment findOne(String application, String profile, String label) {
  NativeEnvironmentRepository delegate = new NativeEnvironmentRepository(getEnvironment(),
      new NativeEnvironmentProperties());
  Locations locations = getLocations(application, profile, label);
  delegate.setSearchLocations(locations.getLocations());
  Environment result = delegate.findOne(application, profile, "");
  result.setVersion(locations.getVersion());
  result.setLabel(label);
  return this.cleaner.clean(result, getWorkingDirectory().toURI().toString(),
      getUri());
}
origin: com.ofg/micro-infra-spring-config

@Override
public PropertySource<?> locate(org.springframework.core.env.Environment environment) {
  final ConfigurableEnvironment configurableEnvironment = (ConfigurableEnvironment) environment;
  final NativeEnvironmentRepository springEnv = new NativeEnvironmentRepository(configurableEnvironment);
  final List<File> propertiesPath = getConfigDirs();
  //https://github.com/spring-cloud/spring-cloud-config/issues/338
  springEnv.setSearchLocations(toSearchLocations(propertiesPath));
  CompositePropertySource composite = new CompositePropertySource(FileSystemLocator.class.getSimpleName());
  addToPropertySource(returnPropertiesForName(springEnv, appCoordinates.getApplicationNameWithCountry()), composite);
  addToPropertySource(returnPropertiesForName(springEnv, appCoordinates.getApplicationNameWithoutCountry()), composite);
  addToPropertySource(returnPropertiesForName(springEnv, ConfigLocations.BASE_FILENAME_FOR_GLOBAL_CONFIG), composite);
  return composite;
}
origin: spring-cloud/spring-cloud-config

@Override
public Environment findOne(String config, String profile, String label) {
  SpringApplicationBuilder builder = new SpringApplicationBuilder(
      PropertyPlaceholderAutoConfiguration.class);
  ConfigurableEnvironment environment = getEnvironment(profile);
  builder.environment(environment);
  builder.web(WebApplicationType.NONE).bannerMode(Mode.OFF);
  if (!logger.isDebugEnabled()) {
    // Make the mini-application startup less verbose
    builder.logStartupInfo(false);
  }
  String[] args = getArgs(config, profile, label);
  // Explicitly set the listeners (to exclude logging listener which would change
  // log levels in the caller)
  builder.application()
      .setListeners(Arrays.asList(new ConfigFileApplicationListener()));
  ConfigurableApplicationContext context = builder.run(args);
  environment.getPropertySources().remove("profiles");
  try {
    return clean(new PassthruEnvironmentRepository(environment).findOne(config,
        profile, label));
  }
  finally {
    context.close();
  }
}
origin: com.ofg/micro-infra-spring-config

private Environment returnPropertiesForName(NativeEnvironmentRepository springEnv, String forName) {
  return springEnv.findOne(forName, appCoordinates.getEnvironment(), null);
}
origin: spring-cloud/spring-cloud-config

public void setSearchLocations(String... locations) {
  this.searchLocations = locations;
  if (locations != null) {
    for (int i = 0; i < locations.length; i++) {
      String location = locations[i];
      if (isDirectory(location) && !location.endsWith("/")) {
        location = location + "/";
      }
      locations[i] = location;
    }
  }
}
origin: spring-cloud/spring-cloud-config

    value = value + "/";
  if (isDirectory(value)) {
    output.add(value);
if (StringUtils.hasText(label)) {
  String labelled = location + label.trim() + "/";
  if (isDirectory(labelled)) {
    output.add(labelled);
origin: spring-cloud/spring-cloud-config

for (String pattern : getLocations(result.getName(), profile,
    result.getLabel()).getLocations()) {
  if (!pattern.contains(":")) {
origin: org.springframework.cloud/spring-cloud-config-monitor

private Set<Path> getFileRepo() {
  if (this.scmRepository != null) {
    try {
      Resource resource = this.resourceLoader.getResource(this.scmRepository.getUri());
      if (resource instanceof FileSystemResource) {
        return Collections.singleton(Paths.get(resource.getURI()));
      }
    }
    catch (IOException e) {
      log.error("Cannot resolve URI for path: " + this.scmRepository.getUri());
    }
  }
  if (this.nativeEnvironmentRepository != null) {
    Set<Path> paths = new LinkedHashSet<>();
    for (String path : this.nativeEnvironmentRepository.getSearchLocations()) {
      Resource resource = this.resourceLoader.getResource(path);
      if (resource.exists()) {
        try {
          paths.add(Paths.get(resource.getURI()));
        }
        catch (Exception e) {
          log.error("Cannot resolve URI for path: " + path);
        }
      }
    }
    return paths;
  }
  return null;
}
org.springframework.cloud.config.server.environmentNativeEnvironmentRepository

Javadoc

Simple implementation of EnvironmentRepository that uses a SpringApplication and configuration files located through the normal protocols. The resulting Environment is composed of property sources located using the application name as the config file stem (spring.config.name) and the environment name as a Spring profile.

Most used methods

  • <init>
  • findOne
  • setSearchLocations
  • clean
  • getArgs
  • getEnvironment
  • getLocations
  • getSearchLocations
  • isDirectory
  • setDefaultLabel

Popular in Java

  • Making http post requests using okhttp
  • setScale (BigDecimal)
  • getSystemService (Context)
  • requestLocationUpdates (LocationManager)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • Notification (javax.management)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now