要基于spring-boot-starter-mail
实现简单的邮件发件人解决方案
添加依赖项并设置属性后,我尝试运行应用程序,并发生了该错误。
我认为值得注意的是,我不是,也不打算实施Spring Cloud。只是邮件服务。
不明白为什么春季启动会期望这些软件包提供某些服务。
尝试了各种版本的依赖关系,定义了一些@Beans,但不认为这是问题所在
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
日志:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-10-23 00:07:05.752 ERROR 19576 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 1 of method mailNotifier in de.codecentric.boot.admin.server.config.AdminServerNotifierAutoConfiguration$MailNotifierConfiguration required a bean of type 'de.codecentric.boot.admin.server.domain.entities.InstanceRepository' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'instanceRepository' in 'AdminServerAutoConfiguration' not loaded because @ConditionalOnBean (types: de.codecentric.boot.admin.server.config.AdminServerMarkerConfiguration$Marker; SearchStrategy: all) did not find any beans of type de.codecentric.boot.admin.server.config.AdminServerMarkerConfiguration$Marker
Action:
Consider revisiting the entries above or defining a bean of type 'de.codecentric.boot.admin.server.domain.entities.InstanceRepository' in your configuration.
只想通过smtp.gmail.com发送电子邮件
希望spring-boot-starter-mail
就足够了。
谢谢!
答案 0 :(得分:0)
正如LHCHIN所说,这是spring-boot-admin-starter-server
中spring-boot-admin-dependencies
和<dependencyManagement/>
的问题