From e15637d1d2adfb5539c63e8c3d3c39b73ad7a8a1 Mon Sep 17 00:00:00 2001 From: Frank Delporte Date: Thu, 25 Apr 2024 16:26:21 +0200 Subject: [PATCH] Bump to Pi4J with integrated BoardInfo --- .../com/pi4j/spring/boot/ContextConfiguration.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConfiguration.java b/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConfiguration.java index 883a702..e28a161 100644 --- a/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConfiguration.java +++ b/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConfiguration.java @@ -2,6 +2,8 @@ import com.pi4j.Pi4J; import com.pi4j.context.Context; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; @@ -11,11 +13,15 @@ @Configuration(proxyBeanMethods = false) @ConditionalOnClass(Context.class) public class ContextConfiguration { - - private final Context pi4j; + private final Logger logger = LoggerFactory.getLogger(ContextConfiguration.class); + private Context pi4j; public ContextConfiguration() { - this.pi4j = Pi4J.newAutoContext(); + try { + this.pi4j = Pi4J.newAutoContext(); + } catch (Error e) { // TODO Temporary fix for https://github.com/Pi4J/pi4j-v2/issues/354 + logger.error("Pi4J library failed to load: {}", e.getMessage()); + } } @Bean