我正在使用郵件API的spring boot 4.2.7。除了郵件相關的所有jar類的路徑和正確加載。我在classpath中有上下文支持和mai api jar。但總是讓classnotfoundexcpetion
Spring引導4.2.7 Mail api在URL中定義名爲'mailSender'的bean找不到類[org.springframework.mail.javamail.JavaMailSenderImpl]
Caused by: org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private
org.springframework.beans.factory.BeanFactory
org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerPostProcessor.beanFactory;
nested exception is
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class [org.springframework.mail.javamail.JavaMailSenderImpl] for
bean with name 'mailSender' defined in URL
[file:/C:workspace_md5/abc/src/main/resources/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException:
org.springframework.mail.javamail.JavaMailSenderImpl
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
... 17 common frames omitted Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class [org.springframework.mail.javamail.JavaMailSenderImpl] for
bean with name 'mailSender' defined in URL
[file:/C:/Users/guptra8/workspace_md5/asg/src/main/resources/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException:
org.springframework.mail.javamail.JavaMailSenderImpl
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1352)
~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:628)
~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]