aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-03-30 00:18:53 +0300
committerGravatar Vitaly Takmazov2024-03-30 00:18:53 +0300
commit8d91efc2094f1ee605637ce76eab6faf6f5a7f66 (patch)
treeabcf416ab1d91a1a146cac8ba758eaa5ba4d4fb8 /src
parentf029a271886085afcb39ee5d407ef75583977dea (diff)
Fix tests
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/config/WebConfig.java8
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());