Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

42.14. 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