718a8bdc0005bd8e816b2ddfbb436d73bffbbfcc
[JavaForFun] /
1 package de.spring.webservices.rest.controller;
2
3 import java.time.LocalDateTime;
4
5 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.web.bind.annotation.RequestBody;
7 import org.springframework.web.bind.annotation.RequestMapping;
8 import org.springframework.web.bind.annotation.RequestMethod;
9
10 import de.spring.stomp.services.UserTradeService;
11
12 public class UserTradeController {
13         private final UserTradeService userTradeService;
14
15     @Autowired
16     public UserTradeController(UserTradeService userTradeService) {
17         this.userTradeService = userTradeService;
18     }
19
20     // Sending data to /topic/greeting from REST service.
21         // POST http://localhost:8080/spring-stomp-server/trade
22     
23         @RequestMapping(path="/trade", method=RequestMethod.POST)
24     public void handle(@RequestBody String user) {
25                 userTradeService.doTrade(user);
26     }
27 }