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