From 38b3ed1ae978c6d5d3af79243c2a5357ea126931 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 2 Sep 2015 09:05:34 -0500 Subject: [PATCH] HHH-10056 - Separate settings for notions of (1) disabling EnversService and (2) auto-registering Envers listeners (cherry picked from commit 73c46e298c24098b89ae8c67712034e95b8095c0) --- .../envers/boot/internal/EnversService.java | 8 +------- .../envers/boot/internal/EnversServiceImpl.java | 14 +++++++++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversService.java b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversService.java index e722bd650f..55ba23e1be 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversService.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversService.java @@ -34,13 +34,7 @@ public interface EnversService extends Service { * The name of the configuration setting used to control whether the Envers integration * is enabled. Default is true */ - public static final String INTEGRATION_ENABLED = "hibernate.integration.envers.enabled"; - - /** - * The name of the legacy configuration setting used to control whether auto registration - * of envers listeners should happen or not. Default is true - */ - public static final String LEGACY_AUTO_REGISTER = "hibernate.listeners.envers.autoRegister"; + String INTEGRATION_ENABLED = "hibernate.integration.envers.enabled"; /** * Is the Envers integration enabled? This is generally used as a diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversServiceImpl.java b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversServiceImpl.java index 54d26e940a..091d319b09 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversServiceImpl.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversServiceImpl.java @@ -50,6 +50,8 @@ import org.jboss.logging.Logger; public class EnversServiceImpl implements EnversService, Configurable, Stoppable { private static final Logger log = Logger.getLogger( EnversServiceImpl.class ); + private static final String LEGACY_AUTO_REGISTER = "hibernate.listeners.envers.autoRegister"; + private boolean integrationEnabled; private boolean initialized; @@ -77,9 +79,15 @@ public class EnversServiceImpl implements EnversService, Configurable, Stoppable @Override public void configure(Map configurationValues) { - final boolean legacySetting = ConfigurationHelper.getBoolean( LEGACY_AUTO_REGISTER, configurationValues, true ); - this.integrationEnabled = ConfigurationHelper.getBoolean( INTEGRATION_ENABLED, configurationValues, legacySetting ); - + if ( configurationValues.containsKey( LEGACY_AUTO_REGISTER ) ) { + log.debugf( + "Encountered deprecated Envers setting [%s]; use [%s] or [%s] instead", + LEGACY_AUTO_REGISTER, + INTEGRATION_ENABLED, + EnversIntegrator.AUTO_REGISTER + ); + } + this.integrationEnabled = ConfigurationHelper.getBoolean( INTEGRATION_ENABLED, configurationValues, true ); log.infof( "Envers integration enabled? : %s", integrationEnabled ); }