相关疑难解决方法(0)

通过java配置进行Spring 4邮件配置

是否有一些关于如何通过java配置配置MailSender的示例?我见过的所有示例都使用xml来创建所需的bean:

<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
   <property name="host" value="mail.mycompany.com"/>
</bean>

<!-- this is a template message that we can pre-load with default state -->
 <bean id="templateMessage" class="org.springframework.mail.SimpleMailMessage">
 <property name="from" value="customerservice@mycompany.com"/>
 <property name="subject" value="Your order"/>
</bean>
Run Code Online (Sandbox Code Playgroud)

email spring spring-java-config

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

email ×1

spring ×1

spring-java-config ×1