如何在Spring Boot中的application.properties中忽略SMTP MailConfiguration

问题描述

我已经实现了rest API,以使用不同的邮件库(如SendGrid,JavaMailAPI,MailChimp等)来触发电子邮件。对于JavaMailAPI,SMTP值未在application.properties中预定义。并且,我将在运行时获取SMTP值。但是,在这种情况下,我得到以下失败消息:

***************************
APPLICATION Failed TO START
***************************

Description:

Parameter 0 of constructor in com.xxx.yyy.service.SendGridEmailService required a bean of type 'com.xxx.yyy.model.EmailRequest' that Could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.xxx.yyy.model.EmailRequest' in your configuration.

当电子邮件请求中包含SMTP值时,如何通过查看属性文件来忽略它?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)