diff --git a/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc b/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc index 8adf686731..1923e45968 100644 --- a/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc +++ b/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc @@ -387,8 +387,8 @@ Enable lazy loading feature in runtime bytecode enhancement. This way, even basi `*hibernate.enhancer.enableAssociationManagement*` (e.g. `true` or `false` (default value)):: Enable association management feature in runtime bytecode enhancement which automatically synchronizes a bidirectional association when only one side is changed. -`*hibernate.bytecode.provider*` (e.g. `javassist` (default value)):: -The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/BytecodeProvider.html[`BytecodeProvider`] built-in implementation flavor. Currently, only `javassist` is supported. +`*hibernate.bytecode.provider*` (e.g. `bytebuddy` (default value)):: +The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/BytecodeProvider.html[`BytecodeProvider`] built-in implementation flavor. Currently, only `bytebuddy` and `javassist` are valid values. `*hibernate.bytecode.use_reflection_optimizer*` (e.g. `true` or `false` (default value)):: Should we use reflection optimization? The reflection optimizer implements the https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/ReflectionOptimizer.html[`ReflectionOptimizer`] interface and improves entity instantiation and property getter/setter calls. diff --git a/hibernate-core/hibernate-core.gradle b/hibernate-core/hibernate-core.gradle index 4a16b583d4..fa1aead733 100644 --- a/hibernate-core/hibernate-core.gradle +++ b/hibernate-core/hibernate-core.gradle @@ -37,9 +37,10 @@ dependencies { // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compile( libraries.jpa ) - compile( libraries.javassist ) - // provided until 6.0 when we make it the default and drop Javassist support - provided( libraries.byteBuddy ) + // Not wanting a transitive dependency on javassist anymore as it's not the default anymore: + provided( libraries.javassist ) + // Could be made optional? + compile( libraries.byteBuddy ) compile( libraries.antlr ) compile( libraries.jta ) compile( libraries.jandex ) diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index f851ec03a0..68de591a75 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -1123,6 +1123,9 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { String CHECK_NULLABILITY = "hibernate.check_nullability"; + /** + * Pick which bytecode enhancing library to use. Currently supports javassist and bytebuddy, bytebuddy being the default since version 5.3. + */ String BYTECODE_PROVIDER = "hibernate.bytecode.provider"; String JPAQL_STRICT_COMPLIANCE= "hibernate.query.jpaql_strict_compliance"; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java index b28427deef..3a0574870b 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java @@ -317,7 +317,7 @@ public final class Environment implements AvailableSettings { public static final String BYTECODE_PROVIDER_NAME_JAVASSIST = "javassist"; public static final String BYTECODE_PROVIDER_NAME_BYTEBUDDY = "bytebuddy"; - public static final String BYTECODE_PROVIDER_NAME_DEFAULT = BYTECODE_PROVIDER_NAME_JAVASSIST; + public static final String BYTECODE_PROVIDER_NAME_DEFAULT = BYTECODE_PROVIDER_NAME_BYTEBUDDY; public static BytecodeProvider buildBytecodeProvider(Properties properties) { String provider = ConfigurationHelper.getString( BYTECODE_PROVIDER, properties, BYTECODE_PROVIDER_NAME_DEFAULT ); diff --git a/hibernate-entitymanager/hibernate-entitymanager.gradle b/hibernate-entitymanager/hibernate-entitymanager.gradle index 689e6c320f..02f16c8234 100644 --- a/hibernate-entitymanager/hibernate-entitymanager.gradle +++ b/hibernate-entitymanager/hibernate-entitymanager.gradle @@ -8,7 +8,6 @@ dependencies { compile( libraries.dom4j ) compile( libraries.commons_annotations ) compile( libraries.jpa ) - compile( libraries.javassist ) compile( libraries.byteBuddy ) compile( libraries.jta ) } diff --git a/hibernate-envers/hibernate-envers.gradle b/hibernate-envers/hibernate-envers.gradle index e29b0aa90b..df5908daa0 100644 --- a/hibernate-envers/hibernate-envers.gradle +++ b/hibernate-envers/hibernate-envers.gradle @@ -12,6 +12,8 @@ description = 'Hibernate\'s entity version (audit/history) support' dependencies { compile( project( ':hibernate-core' ) ) + //Ideally javassist should be only an optional dependency but it's currently required by Envers: see HHH-12327 + compile( libraries.javassist ) provided( [group: 'org.hibernate', name: 'hibernate-tools', version: '3.2.0.ga'] ) provided( libraries.ant ) @@ -19,7 +21,6 @@ dependencies { testCompile( project( ':hibernate-testing' ) ) testCompile( project( path: ':hibernate-core', configuration: 'tests' ) ) - testRuntime( libraries.javassist ) testRuntime( libraries.byteBuddy ) } diff --git a/hibernate-spatial/hibernate-spatial.gradle b/hibernate-spatial/hibernate-spatial.gradle index 53420a444a..26aac5469c 100644 --- a/hibernate-spatial/hibernate-spatial.gradle +++ b/hibernate-spatial/hibernate-spatial.gradle @@ -33,7 +33,6 @@ dependencies { testRuntime( libraries.expression_language ) testRuntime('jaxen:jaxen:1.1') - testRuntime(libraries.javassist) testRuntime(libraries.byteBuddy) } diff --git a/hibernate-testing/hibernate-testing.gradle b/hibernate-testing/hibernate-testing.gradle index ed371b88fd..4d764ac323 100644 --- a/hibernate-testing/hibernate-testing.gradle +++ b/hibernate-testing/hibernate-testing.gradle @@ -16,6 +16,7 @@ dependencies { compile( libraries.byteman ) compile( libraries.byteman_install ) compile( libraries.byteman_bmunit ) + compile( libraries.javassist ) compile( libraries.xapool ) compile( libraries.log4j ) compile ( libraries.jboss_jta ) {