Spring Boot @Async method in controller is executing synchronously

后端 未结 6 1719
天涯浪人
天涯浪人 2020-12-07 18:02

My [basic] Spring Boot application accepts a request from the browser, sent via jQuery.get() and is supposed to immediately receive a response - such as \"y

6条回答
  •  佛祖请我去吃肉
    2020-12-07 18:24

    You are calling the @Async method from another method in the same class. Unless you enable AspectJ proxy mode for the @EnableAsync (and provide a weaver of course) that won't work (google "proxy self-invocation"). The easiest fix is to put the @Async method in another @Bean.

提交回复
热议问题