Test failed with exception
Error creating bean with name 'entityManagerFactory' defined in class path
resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]:
Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError:
Could not initialize class io.hypersistence.utils.hibernate.type.json.JsonBinaryType"
I have dependencies for posgres + jpa + jsonb.
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("io.hypersistence:hypersistence-utils-hibernate-55:3.7.0")
implementation("javax.xml.bind:jaxb-api:2.3.1")
entity
import io.hypersistence.utils.hibernate.type.json.JsonBinaryType
import org.hibernate.annotations.Type
import org.hibernate.annotations.TypeDef
import org.springframework.cloud.gateway.route.RouteDefinition
import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.Id
import javax.persistence.Table
@Entity
@Table(name = "route")
@TypeDef(name = "jsonb", typeClass = JsonBinaryType::class)
class RouteEntity(
@Id
@Column(name = "id", nullable = false)
var id: String,
@Type(type = "jsonb")
@Column(columnDefinition = "jsonb", name = "event_data", nullable = false)
var eventData: RouteDefinition
)
When I run app without test, app run correctly.
But when I build with ‘test’, I have:
Error creating bean with name 'entityManagerFactory' defined in class path
resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: