java.lang.IllegalStateException: Found multiple @SpringBootConfiguration annotated classes 出现这个异常是怎么回事呀
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