mercredi 25 mars 2015

New Spring Data JDK8 Jsr310JpaConverters not working automatically?

I'm trying to use Spring Data JPA 1.8 new jdk date converters.


In my Spring Boot application I've added a config class like:



@Configuration
@ComponentScan(basePackageClasses = LocalContainerEntityManagerFactoryBean.class)
@EnableJpaAuditing
public class DataConfig {
}


This is how org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters suggests how to apply the auto conversion. I also used direct package references like org.springframework.data.jpa.domain.support and org.springframework.data.jpa.convert.threeten.


The problem is the jdk 8 date conversion do not happen resulting in sql exceptions.


However, when I apply the converter manually to in my domain class like:



@Convert(converter = Jsr310JpaConverters.LocalDateConverter.class)
private LocalDate birthdate;


Then the conversion does work.


Aucun commentaire:

Enregistrer un commentaire