From fb51fd2ac0bb7a6cf8dd731b640207d7302a28be Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Fri, 21 Feb 2025 11:04:56 -0300 Subject: [PATCH] Update Application.java.ejs --- .../src/main/java/_package_/Application.java.ejs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/generators/spring-boot/templates/src/main/java/_package_/Application.java.ejs b/generators/spring-boot/templates/src/main/java/_package_/Application.java.ejs index acdafeeda89..2f970aebe03 100644 --- a/generators/spring-boot/templates/src/main/java/_package_/Application.java.ejs +++ b/generators/spring-boot/templates/src/main/java/_package_/Application.java.ejs @@ -92,8 +92,14 @@ public class <%= mainClass %> { */ public static void main(String[] args) { <%_ if (cacheProviderHazelcast) { _%> - // Workaround Hazelcast issue: https://github.com/hazelcast/hazelcast/issues/26361#issuecomment-2489778475 - System.setProperty("spring.devtools.restart.enabled", "false"); + try { + // Workaround Hazelcast issue: https://github.com/hazelcast/hazelcast/issues/26361#issuecomment-2489778475 + Class.forName("org.springframework.boot.devtools.autoconfigure.DevToolsProperties", false, SpringApplication.class.getClassLoader()); + System.setProperty("spring.devtools.restart.enabled", "false"); + LOG.warn("Spring Boot Developer Tools restart has been disabled using System property in order to prevent issues with Hazelcast"); + } catch (Exception e){ + // Devtools not found, ignore + } <%_ } _%> SpringApplication app = new SpringApplication(<%= mainClass %>.class);