diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/QuarkusEnvironment.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/QuarkusEnvironment.java index 06e71499db9a3..de411d39ef1f2 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/QuarkusEnvironment.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/QuarkusEnvironment.java @@ -2,7 +2,7 @@ import java.io.IOException; import java.io.InputStream; -import java.util.HashMap; +import java.util.Collections; import java.util.Map; import java.util.Properties; @@ -17,8 +17,6 @@ */ public class QuarkusEnvironment { - private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Environment.class.getName()); - private static final Map GLOBAL_INITIAL_PROPERTIES; static { @@ -30,6 +28,13 @@ public class QuarkusEnvironment { if (classLoader != null) { InputStream stream = classLoader.getResourceAsStream("/hibernate.properties"); if (stream != null) { + final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Environment.class.getName()); + LOG.warnf( + "The resource hibernate.properties was found in the root of your application. This configuration source is deprecated and will be removed in a future version of Quarkus, " + + + "as it's not compatible with Live Coding, multiple Persistence Units and many more cool features we have planned. Please refrain from " + + + "using it to configure your ORM and use the available configurations in application.properties (check the guide in https://quarkus.io/guides/hibernate-orm#quarkus-hibernate-orm_configuration). Should no configuration exist for your use case please report in: https://github.com/quarkusio/quarkus/issues/. Thank you! "); final Properties p = new Properties(); try { p.load(stream); @@ -42,13 +47,12 @@ public class QuarkusEnvironment { LOG.unableToCloseStreamError(ioe); } } - GLOBAL_INITIAL_PROPERTIES = p; + GLOBAL_INITIAL_PROPERTIES = Collections.unmodifiableMap(p); } else { - LOG.propertiesNotFound(); - GLOBAL_INITIAL_PROPERTIES = new HashMap(); + GLOBAL_INITIAL_PROPERTIES = Collections.EMPTY_MAP; } } else { - GLOBAL_INITIAL_PROPERTIES = new HashMap(); + GLOBAL_INITIAL_PROPERTIES = Collections.EMPTY_MAP; } }