华为开发者联盟HarmonyOS专区 Could not autowire. No beans of 'JavaMailSender' type found..md

Could not autowire. No beans of 'JavaMailSender' type found..md

Could not autowire. No beans of 'JavaMailSender' type found.导入依赖<dependency><groupId>org.springframework.boot</groupId><artifactId>...

Could not autowire. No beans of 'JavaMailSender' type found.

  1. 导入依赖
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-mail</artifactId>
   <version>2.1.5.RELEASE</version>
</dependency>
  1. 配置邮箱相关参数
mail.address = xxx@chinamobile.com
mail.receiver = xxx@126.com
spring.mail.host=smtp.chinamobile.com
spring.mail.username=xxx@chinamobile.com
spring.mail.password=xxx
spring.mail.default-encoding=UTF-8
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=false
spring.mail.properties.mail.smtp.starttls.required=false
  1. 使用

image-20200814155259962

原因:爆红提示找不到Could not autowire. No beans of 'JavaMailSender' type found.,原因是邮箱配置参数找不到

image-20200814155354357

解决:将邮箱配置参数迁移至 resource中 的配置文件中。

image-20200814155423273

image-20200814155447096
Logo

鸿蒙生态一站式服务平台。

更多推荐

  • 浏览量 1.2w
  • 收藏 0
  • 0

所有评论(0)

查看更多评论 
已为社区贡献1条内容