Category Archives: Java

Textdateien mit Spring Batch erzeugen

Wir wollen eine Datei über Spring batch erzeugen. Hierfür benötigen wir einen Marshaller mir “Reader” und “Writer”.

Der Reader:

<bean id="fileReader">
  <property name="dataSource" ref="dataSource" />
  <property name="sql" value="SELECT * FROM table" />
  <property name="rowMapper">
    <bean class="de.package.rowmapper.FileRowMapper" />
  </property>
</bean>

Continue reading “Textdateien mit Spring Batch erzeugen” »

Print Friendly

Send Email by Spring batch with variable attachments

It is very simple to send an Email with attachments by Spring batch framework.

Firstly you need 3 beans for handling the email:
– The first bean initializes JavaMail and sets all needed properties

<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
    <property name="host" value="smtp.yourEmailDomain.de"/>
    <property name="port" value="25"/>
    <property name="username" value="yourUserName"/>
    <property name="password" value="yourPassword"/>
    <property name="javaMailProperties">
        <props>
            <prop key="mail.smtp.auth">true</prop>
        </props>
    </property>
</bean>
Continue reading “Send Email by Spring batch with variable attachments” »

Print Friendly