From 0229ac770f5b17317f79cb90f6523a23d5e1e617 Mon Sep 17 00:00:00 2001 From: Eric Bussieres Date: Thu, 5 Jul 2018 06:47:23 -0400 Subject: [PATCH] Simplify PebbleTemplateAvailabilityProvider --- .../autoconfigure/PebbleTemplateAvailabilityProvider.java | 6 ++---- .../autoconfigure/PebbleTemplateAvailabilityProvider.java | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pebble-spring/pebble-spring-boot-2-starter/src/main/java/com/mitchellbosecke/pebble/boot/autoconfigure/PebbleTemplateAvailabilityProvider.java b/pebble-spring/pebble-spring-boot-2-starter/src/main/java/com/mitchellbosecke/pebble/boot/autoconfigure/PebbleTemplateAvailabilityProvider.java index 12e3a5939..379a2d6b8 100644 --- a/pebble-spring/pebble-spring-boot-2-starter/src/main/java/com/mitchellbosecke/pebble/boot/autoconfigure/PebbleTemplateAvailabilityProvider.java +++ b/pebble-spring/pebble-spring-boot-2-starter/src/main/java/com/mitchellbosecke/pebble/boot/autoconfigure/PebbleTemplateAvailabilityProvider.java @@ -13,11 +13,9 @@ public boolean isTemplateAvailable(String view, Environment environment, ClassLo if (ClassUtils.isPresent("com.mitchellbosecke.pebble.PebbleEngine", classLoader)) { String prefix = environment.getProperty("pebble.prefix", PebbleProperties.DEFAULT_PREFIX); String suffix = environment.getProperty("pebble.suffix", PebbleProperties.DEFAULT_SUFFIX); - return resourceLoader - .getResource(ResourceLoader.CLASSPATH_URL_PREFIX + prefix + view + suffix).exists(); - } else { - return false; + return resourceLoader.getResource(prefix + view + suffix).exists(); } + return false; } } diff --git a/pebble-spring/pebble-spring-boot-starter/src/main/java/com/mitchellbosecke/pebble/boot/autoconfigure/PebbleTemplateAvailabilityProvider.java b/pebble-spring/pebble-spring-boot-starter/src/main/java/com/mitchellbosecke/pebble/boot/autoconfigure/PebbleTemplateAvailabilityProvider.java index 9aa9bc5ba..1435641f0 100644 --- a/pebble-spring/pebble-spring-boot-starter/src/main/java/com/mitchellbosecke/pebble/boot/autoconfigure/PebbleTemplateAvailabilityProvider.java +++ b/pebble-spring/pebble-spring-boot-starter/src/main/java/com/mitchellbosecke/pebble/boot/autoconfigure/PebbleTemplateAvailabilityProvider.java @@ -16,11 +16,9 @@ public boolean isTemplateAvailable(String view, Environment environment, ClassLo PropertyResolver resolver = new RelaxedPropertyResolver(environment, "pebble."); String prefix = resolver.getProperty("prefix", PebbleProperties.DEFAULT_PREFIX); String suffix = resolver.getProperty("suffix", PebbleProperties.DEFAULT_SUFFIX); - return resourceLoader - .getResource(ResourceLoader.CLASSPATH_URL_PREFIX + prefix + view + suffix).exists(); - } else { - return false; + return resourceLoader.getResource(prefix + view + suffix).exists(); } + return false; } }