第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

java.lang.IllegalStateException: Found multiple @SpringBootConfiguration annotated classes 出現(xiàn)這個異常是怎么回事呀

package?com.ep.email.hello;

import?org.springframework.beans.factory.annotation.Autowired;
import?org.springframework.beans.factory.annotation.Value;
import?org.springframework.mail.SimpleMailMessage;
import?org.springframework.mail.javamail.JavaMailSender;
import?org.springframework.stereotype.Service;

@Service
public?class?MailService?{

????@Value("${spring.mail.username}")
????private?String?from;

????@Autowired
????private?JavaMailSender?mailSender;

????public?void?sayHello(){
????????System.out.println("hello?springboot!");
????}

????public?void?sendSimpleMail(String?to,String?subject,String?content){

????????SimpleMailMessage?message=new?SimpleMailMessage();
????????message.setTo(to);
????????message.setSubject(subject);
????????message.setText(content);
????????message.setFrom(from);

????????mailSender.send(message);
????}

}


spring.mail.host=smtp.126.com
spring.mail.username=ityouknow@126.com
spring.mail.password=yourPassword126
spring.mail.default-encoding=UTF-8


pom.xml也配置了依賴mail

正在回答

4 回答

你這個配置文件是客戶端授權(quán)碼,不要用他的那個要用自己郵箱的授權(quán)碼

我是因為測試類里面郵箱后綴忘寫了


0 回復 有任何疑惑可以回復我~

我也遇到了,因為 spring-boot-mail 項目是我們之前helloWorld直接復制過來的,所以會有之前生成的HelloWorldApplication.class 文件

解決方法:把?spring-boot-mail 這個項目 clean 一下,然后再compile 一下,其他不做任何修改,在去執(zhí)行測試代碼即可


0 回復 有任何疑惑可以回復我~

我也遇到了,怎么解決?

0 回復 有任何疑惑可以回復我~

from?? 字段應該是final的

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

java.lang.IllegalStateException: Found multiple @SpringBootConfiguration annotated classes 出現(xiàn)這個異常是怎么回事呀

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號