Home > java > Spring Async: How to call spring hateoas ControllerLinkBuilder inside Async method

Spring Async: How to call spring hateoas ControllerLinkBuilder inside Async method

February 12Hits:3
Advertisement

I am calling ControllerLinkBuilder.linkTo method inside a spring Async method and it fails to find the current request.

service.setUrl(linkTo(Controller.class, Controller.METHOD_GET,                 headers.getFirst(HEADER_SOURCE), id).toString()); 

Exception:

java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Could not find current request via RequestContextHolder Caused by: java.lang.IllegalStateException: Could not find current request via RequestContextHolder 

Related Articles

  • Spring Async: How to call spring hateoas ControllerLinkBuilder inside Async methodFebruary 12

    I am calling ControllerLinkBuilder.linkTo method inside a spring Async method and it fails to find the current request. service.setUrl(linkTo(Controller.class, Controller.METHOD_GET, headers.getFirst(HEADER_SOURCE), id).toString()); Exception: java.u

  • Spring loaded 1.2.5 + Spring Boot 1.3.2. can't seem to get it to workJanuary 26

    I came across a video on youtube ( https://www.youtube.com/watch?v=GTrNkhVnJBU ) where it demos Spring Loaded. I'm trying to duplicate the same behavior but am still unsuccessful so far. What I'm using: Spring Tool Suite 3.7.2 Spring Boot 1.3.2-RELEA

  • Async processes in Java SpringJune 19

    I need to refactor this class having in mind that the logic inside the call methods is not so short and it require spring dependencies to work, the base class I have is: @Service public class ConcurrentService{ @Autowired private Service1 service1; @

  • Continuations (Async Web Services) in Spring 15 SandboxJanuary 13

    According to Spring 15 release notes, Continuations class should be available in Spring 15. I have a preview Sandbox (on CS21) but this feature does not appear to be enabled as the Apex does not compile when referencing the Continuations class. Do I

  • How to use Async task executor in spring batchJanuary 23

    Can someone point me in right direction in how to use a Async task executor with reader , writer and processor . Facing some multi threading issue when using flat file item reader , custom writer and processor Thanks

  • Getting a Spring Exception when not using SpringJanuary 25

    I am encountering a problem getting CDI to work with a JAX-WS web service implementation. While trying to debug this problem, however, I am seeing an exception in the logs that I am having trouble understanding. The log, and the exception is (5th lin

  • Thymeleaf form with spring 4:how to force spring to take typed user and not anonymous?January 26

    The initial issue was the one stated here Thymeleaf form with spring 4: Etat HTTP 405 - Request method 'GET' not supported Now it is resolved but I faced another issue which is spring is taking anonymous User instead of my user. Here is my security c

  • Multiple spring-ws services into one spring boot application. Java configurationFebruary 4

    I need to implement stub services for several remote jax-ws services. It should to be run under one jar application. So I have wsdl files of the services and can compile it into java classes. Using spring tutorial I can run one service with one endpo

  • Spring framework compatibility with other spring projectsFebruary 12

    We are trying to upgrade our repo with all latest spring project versions. For eg. we are planning to upgrade to spring code at 4.2 version. But we need information about its compatibility with spring boot or spring batch versions so we can upgrade t

  • Async Log4net logging handler - High CPU usage on async callMay 2

    I've got a LoggingMessageHandler that incoming requests on my WebApi application filter through. public class LoggingMessageHandler : DelegatingHandler { public ILogManager LogManager { get; set; } //injected protected override async Task<HttpRespons

  • can I use async.waterfall inside async.parallel?February 14

    I want to call two functions and get the results in parallel but one of the function's results needed to be adapted. So the function structure is: function test(cb) { async.parallel({ func1: function foo(cb1) { cb(null, {}); }, func2: function bar(cb

  • Mutate inout function paramter inside async blockJanuary 27

    I have the following playground code: import UIKit import XCPlayground class A { var arr : [UIImage] = [] func addItem(inout localArr: [UIImage]) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (Int64)(2 * NSEC_PER_SEC)), dispatch_get_main_queue())

  • @Async Spring annotation doesn't workJanuary 20

    I have a method that must create a zip and mat file from the original file uploaded from the user. So I decided to store only the original file and then, in an async task I would like to create the other two files. I read that the @Async annotation h

  • Is it possible to make an async jax-ws webservice call with spring-wsJanuary 20

    I am trying to figure out if it is possible to make an async jax-ws webservice call with spring-ws? I can't find any examples of this online. I know that I can use the @Async annotation of spring to asynchronously call a method, but I want to take ad

  • Spring-Data-JPA Async Support for Save not there?January 24

    I am trying to create a non-blocking rest service with Spring Boot and Spring data JPA. How to do Async save of an entity with Spring Data JPA @Async support. Below code is not working for me although other selects seem to be working on the same enti

  • webapp doesnt start after spring-boot update to 1.3.1January 14

    I hope you can help me with this problem and couldn't find a solution. I am working on a Webapplication with gradle 2.4, Java 8, Spring-boot and a H2-DB. We started with Spring-Boot 1.2.2 a while ago and decided to update Spring-Boot to 1.3.1. But wi

  • Spring Boot REST API - request timeout?January 18

    I have a Spring Boot REST service that sometimes call third party services as a part of a request. I would like to set a timeout on all my resources (let's say 5 seconds), so that if any request handling (the whole chain, from incoming to response) t

  • Send JSON data from Ember to SpringJanuary 26

    I try to send JSON data from my Ember application to Spring REST application, but in spring console i see: json = %7B%22username%22%3A%22userTest%22%2C%22password%22%3A%22passwordTest%22%7D= What is wrong with this POST request? create() { var _this

  • JDBC CommunicationsException in Spring Data JPAFebruary 5

    I have a Spring Boot application that uses Data JPA / Hibernate / JDBC and MySQL with a default timeout of 8 hours. When left running overnight, it crashes with the following exception: javax.persistence.PersistenceException: org.hibernate.exception.

  • Unable to run spring boot application something wrong with mappingjackson2httpmessageconverterFebruary 10

    I am trying to start my spring boot application but not able to. following are the files. According it me something is wrong with mappingjackson2httpmessageconverter. Config.java @Configuration @EnableTransactionManagement @PropertySource("classpath:

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.509 s.