I was able to solve my problem thanks to @Boris the Spider. The correct solution is to do something like that :
@Controller
@RequestMapping("https://stackoverflow.com/")
public class PhotoController {
@Autowired
private SimpMessagingTemplate template;
@MessageMapping("/form")
@SendTo("/topic/greetings")
public Greeting validate(AddPhotosForm addPhotosForm) {
FireGreeting r = new FireGreeting( this );
new Thread(r).start();
return new Greeting("Hello world !");
}
public void fireGreeting() {
System.out.println("Fire");
this.template.convertAndSend("/topic/greetings", new Greeting("Fire"));
}
}