问题
I've found Mail Integration in the Spring Docs, a mail channel example with XML configuration, a suggestion to use Jasypt to encrypt the userid/password in the XML config, and an XML-based config in the Spring Boot Samples repo, but I have not figured out how to securely configure and use an email channel in a Spring Boot web app that is using annotations.
I looked for ways to incorporate XML bean definitions, and how to convert XML to annotations, but came up empty.
How should I configure mail channels for sending and receiving email in a Spring Boot app?
Thanks!
回答1:
The spring boot integration starter doesn't include mail support; you simply need to add the spring-integration-mail artifact to your pom; you can then configure the mail channel adapters in XML as needed.
You can use @ImportResource to combine XML configuration with a @Configuration class.
来源:https://stackoverflow.com/questions/24872001/how-to-configure-a-mail-channel-in-spring-boot