Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | Github | OSChina 博客 | 云社区 | 云栖社区 | Facebook | Linkedin | 视频教程 | 打赏(Donations) | About
知乎专栏多维度架构 微信号 netkiller-ebook | QQ群:128659835 请注明“读者”

10.5. Field javaMailSender in cn.netkiller.rest.EmailRestController required a bean of type 'org.springframework.mail.javamail.JavaMailSender' that could not be found.

启动提示 'org.springframework.mail.javamail.JavaMailSender' that could not be found 这句话很误导人。实际上是 (spring.mail.host) did not find property 'host'

			***************************
			APPLICATION FAILED TO START
			***************************

			Description:

			Field javaMailSender in cn.netkiller.rest.EmailRestController required a
			bean of type 'org.springframework.mail.javamail.JavaMailSender' that
			could not be found.
			- Bean method 'mailSender' not loaded because AnyNestedCondition 0
			matched 2 did not; NestedCondition on
			MailSenderAutoConfiguration.MailSenderCondition.JndiNameProperty
			@ConditionalOnProperty (spring.mail.jndi-name) did not find property
			'jndi-name';
			NestedCondition on
			MailSenderAutoConfiguration.MailSenderCondition.HostProperty
			@ConditionalOnProperty (spring.mail.host) did not find property
			'host'


			Action:

			Consider revisiting the conditions above or defining a bean of type
			'org.springframework.mail.javamail.JavaMailSender' in your
			configuration.
		

解决方案,application.properties 增加 spring.mail.host=localhost