I have simple Spring Boot 2.5.7 JPA application and want audit diff between some entities
So my pom.xml include this dependency
<dependency>
<groupId>org.javers</groupId>
<artifactId>javers-spring-boot-starter-sql</artifactId>
<version>6.5.1</version>
</dependency>
I tried config in applciation
javers:
algorithm: levenshtein_distance
dialect: POSTGRES
I created bean
@Bean
public Javers javers() {
return JaversBuilder.javers()
.withListCompareAlgorithm(ListCompareAlgorithm.LEVENSHTEIN_DISTANCE)
.build();
}
Also I tried add this annotation - JaversSpringDataAuditable
My service class
@Service
@RequiredArgsConstructor
public class TestService {
private final Javers javers;
}
All I want is to know the difference between the two entities https://javers.org/documentation/diff-configuration/
But I keep getting the same error
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.javers.repository.sql.DialectName]: Factory method 'javersSqlDialectName' threw exception; nested exception is java.lang.ClassCastException: class jdk.proxy2.$Proxy204 cannot be cast to class org.hibernate.engine.spi.SessionFactoryImplementor (jdk.proxy2.$Proxy204 is in module jdk.proxy2 of loader 'app'; org.hibernate.engine.spi.SessionFactoryImplementor is in unnamed module of loader 'app')
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 62 common frames omitted
Caused by: java.lang.ClassCastException: class jdk.proxy2.$Proxy204 cannot be cast to class org.hibernate.engine.spi.SessionFactoryImplementor (jdk.proxy2.$Proxy204 is in module jdk.proxy2 of loader 'app'; org.hibernate.engine.spi.SessionFactoryImplementor is in unnamed module of loader 'app')
at org.javers.spring.boot.sql.JaversSqlAutoConfiguration.javersSqlDialectName(JaversSqlAutoConfiguration.java:56)
at org.javers.spring.boot.sql.JaversSqlAutoConfiguration$$EnhancerBySpringCGLIB$$e6ec8ead.CGLIB$javersSqlDialectName$0(<generated>)
at org.javers.spring.boot.sql.JaversSqlAutoConfiguration$$EnhancerBySpringCGLIB$$e6ec8ead$$FastClassBySpringCGLIB$$466a8b80.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at org.javers.spring.boot.sql.JaversSqlAutoConfiguration$$EnhancerBySpringCGLIB$$e6ec8ead.javersSqlDialectName(<generated>)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 63 common frames omitted