I'm a bit confused and I need some clarification:

I'm trying to transform a object in json and send it using jms each second.

Here is my context.xml:

```
<bean id="connectionFactory"
    class="org.springframework.jms.connection.CachingConnectionFactory">
    <property name="targetConnectionFactory">
        <bean class="org.apache.activemq.ActiveMQConnectionFactory">
            <property name="brokerURL" value="tcp://localhost:61616" />
        </bean>
    </property>
    <property name="sessionCacheSize" value="10" />
</bean>
<bean id="requestTopic" class="org.apache.activemq.command.ActiveMQTopic">
    <constructor-arg value="testconf" />
</bean>

<bean id="confbean" class="demo.DeviceConfiguration">
    <property name="id" value="THERMO_001" />
    <property name="name" value="thermometer" />
</bean>

<int:channel id="deadChannel"/>
<int:channel id="outboundChannel"/>
<int:channel id="objectToJsonChannel" />
<int:channel id="outJmsChannel" />
<int:channel id="requestChannel"/>

<int:gateway id="gateway"
    default-request-timeout="5000"
    default-reply-timeout="5000"
    default-request-channel="requestChannel"
    service-interface="demo.ServiceConfGateway">
</int:gateway>

<int:payload-type-router input-channel="requestChannel" default-output-channel="deadChannel">
    <int:mapping type="demo.DeviceConfiguration" channel="objectToJsonChannel"/>
</int:payload-type-router>

<int:object-to-json-transformer input-channel="objectToJsonChannel" output-channel="outJmsChannel" />

<int-jms:outbound-channel-adapter id="jmsout" channel="outJmsChannel" destination="requestTopic" />

```

In my Main class, I'm doing this:

```
    SpringApplication.run(DemoJmsApplication.class, args);
    ApplicationContext ctx = new ClassPathXmlApplicationContext("context.xml");
    final DeviceConfiguration dc = ctx.getBean(DeviceConfiguration.class);
    final ServiceConfGateway service = ctx.getBean(ServiceConfGateway.class);

    while (true) {
        service.send(dc);
        Thread.sleep(1000);
    }

```

Do I need this loop in my Main class?
This is working but I think I could simplify it.