ozimov / spring-boot-email-tools

A set of services and tools for sending emails in a Spring Boot 1.5.x application using a Template Engine
Apache License 2.0
195 stars 95 forks source link

Upgrade for Spring Boot 2.0 #71

Closed rvullriede closed 6 years ago

rvullriede commented 6 years ago

When trying to use the package with Spring Boot 2.0 I get the following exception:

Caused by: java.lang.IllegalStateException: Failed to introspect Class [it.ozimov.springboot.mail.templating.service.ThymeleafTemplateService] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
    at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:759) ~[spring-core-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.util.ReflectionUtils.doWithLocalFields(ReflectionUtils.java:691) ~[spring-core-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:410) ~[spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:394) ~[spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:332) ~[spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1016) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    ... 20 common frames omitted
Caused by: java.lang.NoClassDefFoundError: Lorg/thymeleaf/spring4/SpringTemplateEngine;
    at java.lang.Class.getDeclaredFields0(Native Method) ~[na:1.8.0_144]
    at java.lang.Class.privateGetDeclaredFields(Class.java:2583) ~[na:1.8.0_144]
    at java.lang.Class.getDeclaredFields(Class.java:1916) ~[na:1.8.0_144]
    at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:754) ~[spring-core-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    ... 26 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.thymeleaf.spring4.SpringTemplateEngine
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_144]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_144]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_144]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_144]
    ... 30 common frames omitted`

Seems like an issue with the reference to org.thymeleaf.spring4.SpringTemplateEngine since Spring Boot 2.0 uses Spring 5, specifically:

org.springframework.boot:spring-boot-starter-mail:2.0.0.RELEASE
org.springframework:spring-core:5.0.4.RELEASE
org.thymeleaf:thymeleaf:3.0.9.RELEASE
robertotru commented 6 years ago

I know, it can't work. Current version has been built for Spring Boot 1.5.x. I must find some time to fix the code for Spring Boot 2.x.

rvullriede commented 6 years ago

So why close it? Shouldn't it stay open until it is fixed?

robertotru commented 6 years ago

It is not an issue for me, but a feature request. This project has been designed to work with another major release of Spring Boot. Unfortunately 2.0.0 is a new major release of Spring Boot that is not backward compatible. I may decide to never upgrade, if I have no convenience. I actually have no specific interest in this project (since I have other major projects to work on), but I accept any contribution. It may happen that I will do it in one month or never. Sorry for that.

robertotru commented 6 years ago

This will be tacked in https://github.com/ozimov/spring-boot-email-tools/issues/72