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