use of org.springframework.core.env.PropertyResolver in project spring-boot by spring-projects.
the class LogFileTests method loggingPath.
@Test
public void loggingPath() throws Exception {
PropertyResolver resolver = getPropertyResolver(null, "logpath");
LogFile logFile = LogFile.get(resolver);
Properties properties = new Properties();
logFile.applyTo(properties);
assertThat(logFile.toString()).isEqualTo("logpath/spring.log");
assertThat(properties.getProperty("LOG_FILE")).isEqualTo("logpath/spring.log");
assertThat(properties.getProperty("LOG_PATH")).isEqualTo("logpath");
}
use of org.springframework.core.env.PropertyResolver in project spring-boot by spring-projects.
the class LogFileTests method loggingFileAndPath.
@Test
public void loggingFileAndPath() throws Exception {
PropertyResolver resolver = getPropertyResolver("log.file", "logpath");
LogFile logFile = LogFile.get(resolver);
Properties properties = new Properties();
logFile.applyTo(properties);
assertThat(logFile.toString()).isEqualTo("log.file");
assertThat(properties.getProperty("LOG_FILE")).isEqualTo("log.file");
assertThat(properties.getProperty("LOG_PATH")).isEqualTo("logpath");
}
use of org.springframework.core.env.PropertyResolver in project spring-boot by spring-projects.
the class ThymeleafTemplateAvailabilityProvider method isTemplateAvailable.
@Override
public boolean isTemplateAvailable(String view, Environment environment, ClassLoader classLoader, ResourceLoader resourceLoader) {
if (ClassUtils.isPresent("org.thymeleaf.spring5.SpringTemplateEngine", classLoader)) {
PropertyResolver resolver = new RelaxedPropertyResolver(environment, "spring.thymeleaf.");
String prefix = resolver.getProperty("prefix", ThymeleafProperties.DEFAULT_PREFIX);
String suffix = resolver.getProperty("suffix", ThymeleafProperties.DEFAULT_SUFFIX);
return resourceLoader.getResource(prefix + view + suffix).exists();
}
return false;
}
use of org.springframework.core.env.PropertyResolver in project spring-boot by spring-projects.
the class MustacheTemplateAvailabilityProvider method isTemplateAvailable.
@Override
public boolean isTemplateAvailable(String view, Environment environment, ClassLoader classLoader, ResourceLoader resourceLoader) {
if (ClassUtils.isPresent("com.samskivert.mustache.Template", classLoader)) {
PropertyResolver resolver = new RelaxedPropertyResolver(environment, "spring.mustache.");
String prefix = resolver.getProperty("prefix", MustacheProperties.DEFAULT_PREFIX);
String suffix = resolver.getProperty("suffix", MustacheProperties.DEFAULT_SUFFIX);
return resourceLoader.getResource(prefix + view + suffix).exists();
}
return false;
}
use of org.springframework.core.env.PropertyResolver in project spring-boot by spring-projects.
the class JspTemplateAvailabilityProvider method getResourceName.
private String getResourceName(String view, Environment environment) {
PropertyResolver resolver = new RelaxedPropertyResolver(environment, "spring.mvc.view.");
String prefix = resolver.getProperty("prefix", WebMvcAutoConfiguration.DEFAULT_PREFIX);
String suffix = resolver.getProperty("suffix", WebMvcAutoConfiguration.DEFAULT_SUFFIX);
return prefix + view + suffix;
}
Aggregations