From cf6822614dc374001077cee91978720a6a1bab58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20M=C3=BCller?= Date: Fri, 26 Jul 2024 15:29:55 +0200 Subject: [PATCH] fix(core): Fix startup when Spring WebMVC is not used Only use SpringwolfUiResourceConfiguration if the required beans are present in the spring context (WebMvcProperties, WebProperties) Co-authored-by: Timon Back --- .../core/configuration/SpringwolfUiResourceConfiguration.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/configuration/SpringwolfUiResourceConfiguration.java b/springwolf-core/src/main/java/io/github/springwolf/core/configuration/SpringwolfUiResourceConfiguration.java index 3b6c363a0..cd5527f39 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/configuration/SpringwolfUiResourceConfiguration.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/configuration/SpringwolfUiResourceConfiguration.java @@ -1,12 +1,16 @@ // SPDX-License-Identifier: Apache-2.0 package io.github.springwolf.core.configuration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.web.WebProperties; +import org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration @ConditionalOnClass(WebMvcConfigurer.class) +@ConditionalOnBean({WebMvcProperties.class, WebProperties.class}) @Import(SpringwolfUiResourceConfigurer.class) public class SpringwolfUiResourceConfiguration {}