When I use the command mvn spring-boot:run the project compiles and starts perfectly. However, when I use the play-button in my IDE (IntelliJ), I get the following error:
Description:
Parameter 3 of constructor in com.example.module.services.PdfService required a bean of type 'org.springframework.mail.javamail.JavaMailSender' that could not be found.
What might be the reason for this? I`d love to use the debugging and dev tools provided by the IDE.
What I 've tried:
- Select Build->Rebuild Project
- Clicking File>Invalidate caches/ restart
- mvn clean -> Build -> Make Project
- Maven -> Reimport
- Checked that there is no excludes in Preferences | Build, Execution, Deployment | Compiler | Excludes
My pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
The Service in which the error occurs
@Service
public class PdfService {
private final Logger logger = LoggerFactory.getLogger(PdfService.class);
private PdfCreator pdfCreator;
private ConfigProperties properties;
private ReceiptService receiptService;
private JavaMailSender javaMailSender;
private MessageSourceAccessor messageSourceAccessor;
@Autowired
public PdfService(PdfCreator pdfCreator,
ConfigProperties properties,
ReceiptService receiptService,
JavaMailSender javaMailSender,
MessageSourceAccessor messageSourceAccessor) {
this.pdfCreator = pdfCreator;
this.properties = properties;
this.receiptService = receiptService;
this.javaMailSender = javaMailSender;
this.messageSourceAccessor = messageSourceAccessor;
}
Help is very much appreciated.