All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.boot.actuate.info.ResourceInfoContributor Maven / Gradle / Ivy

package org.springframework.boot.actuate.info;

import java.io.File;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;

import org.springframework.boot.actuate.info.Info.Builder;
import org.springframework.util.ResourceUtils;

/**
 * @see org.springframework.core.io.support.ResourcePatternUtils#getResourcePatternResolver(org.springframework.core.io.ResourceLoader)
 * @see org.springframework.core.io.DefaultResourceLoader
 */
public class ResourceInfoContributor implements org.springframework.boot.actuate.info.InfoContributor {
  @Override
  public void contribute(Builder builder) {
    Map resource = new LinkedHashMap();
    try {
      resource.put("file", ResourceUtils.getFile("file:").getCanonicalFile());
      resource.put("classpath", ResourceUtils.getFile("classpath:").getCanonicalFile());
    }
    catch (IOException e) {
      // ignore
    }
    builder.withDetail("resource", resource);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy