Skip to content

Commit

Permalink
Merge pull request #10526 from Sanne/DeprecateHibernateProperties
Browse files Browse the repository at this point in the history
Deprecate hibernate.properties resource
  • Loading branch information
Sanne authored Jul 7, 2020
2 parents e13c9e7 + 4e3d696 commit 3b43b3b
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 {
Expand All @@ -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);
Expand All @@ -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;
}
}

Expand Down

0 comments on commit 3b43b3b

Please sign in to comment.