Skip to content

Commit 38b3ed1

Browse files
committed
HHH-10056 - Separate settings for notions of (1) disabling EnversService and (2) auto-registering Envers listeners
(cherry picked from commit 73c46e2)
1 parent 5eb5ab4 commit 38b3ed1

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversService.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ public interface EnversService extends Service {
3434
* The name of the configuration setting used to control whether the Envers integration
3535
* is enabled. Default is true
3636
*/
37-
public static final String INTEGRATION_ENABLED = "hibernate.integration.envers.enabled";
38-
39-
/**
40-
* The name of the legacy configuration setting used to control whether auto registration
41-
* of envers listeners should happen or not. Default is true
42-
*/
43-
public static final String LEGACY_AUTO_REGISTER = "hibernate.listeners.envers.autoRegister";
37+
String INTEGRATION_ENABLED = "hibernate.integration.envers.enabled";
4438

4539
/**
4640
* Is the Envers integration enabled? This is generally used as a

hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversServiceImpl.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
public class EnversServiceImpl implements EnversService, Configurable, Stoppable {
5151
private static final Logger log = Logger.getLogger( EnversServiceImpl.class );
5252

53+
private static final String LEGACY_AUTO_REGISTER = "hibernate.listeners.envers.autoRegister";
54+
5355
private boolean integrationEnabled;
5456
private boolean initialized;
5557

@@ -77,9 +79,15 @@ public class EnversServiceImpl implements EnversService, Configurable, Stoppable
7779

7880
@Override
7981
public void configure(Map configurationValues) {
80-
final boolean legacySetting = ConfigurationHelper.getBoolean( LEGACY_AUTO_REGISTER, configurationValues, true );
81-
this.integrationEnabled = ConfigurationHelper.getBoolean( INTEGRATION_ENABLED, configurationValues, legacySetting );
82-
82+
if ( configurationValues.containsKey( LEGACY_AUTO_REGISTER ) ) {
83+
log.debugf(
84+
"Encountered deprecated Envers setting [%s]; use [%s] or [%s] instead",
85+
LEGACY_AUTO_REGISTER,
86+
INTEGRATION_ENABLED,
87+
EnversIntegrator.AUTO_REGISTER
88+
);
89+
}
90+
this.integrationEnabled = ConfigurationHelper.getBoolean( INTEGRATION_ENABLED, configurationValues, true );
8391
log.infof( "Envers integration enabled? : %s", integrationEnabled );
8492
}
8593

0 commit comments

Comments
 (0)