HHH-10056 - Separate settings for notions of (1) disabling EnversService and (2) auto-registering Envers listeners
(cherry picked from commit 73c46e298c
)
This commit is contained in:
parent
5eb5ab4920
commit
38b3ed1ae9
|
@ -34,13 +34,7 @@ public interface EnversService extends Service {
|
||||||
* The name of the configuration setting used to control whether the Envers integration
|
* The name of the configuration setting used to control whether the Envers integration
|
||||||
* is enabled. Default is true
|
* is enabled. Default is true
|
||||||
*/
|
*/
|
||||||
public static final String INTEGRATION_ENABLED = "hibernate.integration.envers.enabled";
|
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";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the Envers integration enabled? This is generally used as a
|
* Is the Envers integration enabled? This is generally used as a
|
||||||
|
|
|
@ -50,6 +50,8 @@ import org.jboss.logging.Logger;
|
||||||
public class EnversServiceImpl implements EnversService, Configurable, Stoppable {
|
public class EnversServiceImpl implements EnversService, Configurable, Stoppable {
|
||||||
private static final Logger log = Logger.getLogger( EnversServiceImpl.class );
|
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 integrationEnabled;
|
||||||
private boolean initialized;
|
private boolean initialized;
|
||||||
|
|
||||||
|
@ -77,9 +79,15 @@ public class EnversServiceImpl implements EnversService, Configurable, Stoppable
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(Map configurationValues) {
|
public void configure(Map configurationValues) {
|
||||||
final boolean legacySetting = ConfigurationHelper.getBoolean( LEGACY_AUTO_REGISTER, configurationValues, true );
|
if ( configurationValues.containsKey( LEGACY_AUTO_REGISTER ) ) {
|
||||||
this.integrationEnabled = ConfigurationHelper.getBoolean( INTEGRATION_ENABLED, configurationValues, legacySetting );
|
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 );
|
log.infof( "Envers integration enabled? : %s", integrationEnabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue