diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/juick/config/WebConfig.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/juick/config/WebConfig.java b/src/main/java/com/juick/config/WebConfig.java index 43857bb5..a5545c48 100644 --- a/src/main/java/com/juick/config/WebConfig.java +++ b/src/main/java/com/juick/config/WebConfig.java @@ -61,6 +61,7 @@ public class WebConfig implements WebMvcConfigurer { @Inject private UserService userService; + private boolean testsAreRunning = false; private boolean devToolsArePresent = false; @PostConstruct public void initConfiguration() { @@ -70,6 +71,11 @@ public class WebConfig implements WebMvcConfigurer { } catch (ClassNotFoundException e) { // release mode } + for (StackTraceElement s : Thread.currentThread().getStackTrace()) { + if (s.getClassName().contains("org.springframework.boot.test.context.SpringBootContextLoader")) { + testsAreRunning = true; + } + } } @Override @@ -122,7 +128,7 @@ public class WebConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { try { - if (devToolsArePresent) { + if (devToolsArePresent && !testsAreRunning) { registry .addResourceHandler("/**", "/i/a/**") .addResourceLocations("classpath:/static/", Paths.get(baseDir, "/i/a/").toUri().toURL().toString()); |