By default, EclipseLink expects run-time weaving to be enabled, otherwise you will receive an error in the form 'Cannot apply class transformer without LoadTimeWeaver specified'. This means that for cases using build-time weaving or no weaving at all, you will need to explicitly indicate this behavior. In order to disable EclipseLink weaving you will need to either configure an application's EntityManagerFactory Spring bean with:
<property name="jpaPropertyMap">
<map>
<entry key="eclipselink.weaving" value="false"/>
</map>
</property>
or add the
<property name="eclipselink.weaving" value="false"/>
to your application's persistence.xml file.
I recommend to activate the weaving since it's a great improve in performance.
To configure the default run-time weaver expected by EclipseLink, add the following:
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
</property>
to your application's EntityManagerFactory Spring bean.
Then add this option to your JVM :
-javaagent:/path-to-your-javaagent/org.springframework.instrument-3.1.1.RELEASE.jar
In Spring 3.x the javaagent is localized in the org.springframework.instrument jar.
You need the org.springframework.instrument library together with aspectjrt.jar and aspectjweaver.jar libraries.
Reference
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…