我有一个完全注释驱动的Spring Boot 1.3.5应用程序,它有这个异步服务需要自动装配另一个服务bean(并且将来它需要自动装配一个存储库bean,但我还没有)按顺序执行一些业务逻辑:
@Service
public class AsyncService {
@Autowired
public HelpingService helpingService;
@Async
public Future<String> doFoo(String someArgument)
throws InterruptedException {
Thread.sleep(3000);
System.out.println("about to do Foo "+someArgument);
String result = "";
try {
result = helpingService.getSomeStuff(someArgument);
}
catch (Exception e) {
e.printStackTrace();
}
return new AsyncResult<String>(hello);
}
}
Run Code Online (Sandbox Code Playgroud)
上面的方法是从@Controller bean调用的,它有其他端点(非异步),它们也按预期工作
@Controller
public class MyController extends BaseController {
@Autowired
HelpingService helpingService;
@Autowired
AsyncService asyncService;
@RequestMapping(method=RequestMethod.GET, value={"/rest/threads/getIp/{jobId}"}, produces={"application/json"})
public ResponseEntity<?> getLog(@PathVariable("jobId") String jobId) throws InterruptedException {
asyncService.doFoo(jobId);
return new ResponseEntity<>(HttpStatus.OK);
}
}
Run Code Online (Sandbox Code Playgroud)
这里 …
因此,我有一个 jFrame,在其中构建聊天的主界面窗口。这个 window/jFrame 有几个按钮,每个按钮都显示一个 jDialog (我之前在 Netbeans 中创建的,将 jDialog 拖到父级(?) jFrame 上)。
\n\n我的问题是两个窗口都设置为undecorated = true
,所以我希望让用户通过单击并拖动窗口的一部分来随意拖动和移动所有窗口(在未装饰时模拟标题栏)
在所有 jFrame 中,我通过以下代码完成了此操作initComponents()
:
final Point point = new Point(0,0); // Why \'final\' and not simply Point point? \n addMouseListener(new MouseAdapter() { \n public void mousePressed(MouseEvent e) { \n if(!e.isMetaDown()){ \n point.x = e.getX(); \n point.y = e.getY(); \n System.out.println("Rat\xc3\xb3n pulsado: " + point.x + "," + point.y);\n } \n } \n });\n\n addMouseMotionListener(new MouseMotionAdapter() { \n public void …
Run Code Online (Sandbox Code Playgroud)