parent
5b7b4f6a1b
commit
5084c50f1c
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:task="http://www.springframework.org/schema/task"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/task https://www.springframework.org/schema/task/spring-task.xsd
|
||||||
|
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
<task:scheduler id="myScheduler" pool-size="10" />
|
||||||
|
|
||||||
|
<bean id="testMessageSender"
|
||||||
|
class="com.example.sshd.service.MessageSender">
|
||||||
|
<property name="fromJID" value="" />
|
||||||
|
<property name="toJID" value="" />
|
||||||
|
<property name="message" value="" />
|
||||||
|
</bean>
|
||||||
|
<task:scheduled-tasks scheduler="myScheduler">
|
||||||
|
<task:scheduled ref="testMessageSender"
|
||||||
|
method="sendMessage" cron="* * * * * ?" />
|
||||||
|
</task:scheduled-tasks>
|
||||||
|
|
||||||
|
</beans>
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.example.sshd.service;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
public class MessageSender {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
EchoComponent echoComponent;
|
||||||
|
|
||||||
|
private String fromJID, toJID, message;
|
||||||
|
|
||||||
|
public void sendMessage() {
|
||||||
|
echoComponent.sendMessage(fromJID, toJID, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFromJID() {
|
||||||
|
return fromJID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFromJID(String fromJID) {
|
||||||
|
this.fromJID = fromJID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToJID() {
|
||||||
|
return toJID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToJID(String toJID) {
|
||||||
|
this.toJID = toJID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue