Questions tagged [requestscope]

57 questions
7
votes
2 answers

Does Spring's @RequestScope automatically handle proxying when injected in singleton beans?

I'm using a Java8/Spring Boot 2 application. I want to inject a request-scoped bean into a singleton bean. The official documentation highlights that either a proxy or ObjectFactory/Provider should be used to ensure always getting the correctly…
user1884155
  • 3,616
  • 4
  • 55
  • 108
5
votes
2 answers

Is it able to inject RequestScope bean into Singleton bean using Constructor Injection in Spring?

It is working as far as I tested. But I do not get it why and how it works.(Also I am not sure it is safe to use in production) Here is my testCode @Service public class SomeService { private static final Logger logger =…
Juneyoung Oh
  • 7,318
  • 16
  • 73
  • 121
5
votes
1 answer

ThreadStatic in asynchronous ASP.NET Web API

Is there a possibility to use thread static like variables within a single request? The current code uses a thread static variable for logging purposes and now we want to use async controller methods (with async and await pattern) which results in…
4
votes
1 answer

Guice Request-scoped injection without a servlet (in an RPC server)

For background, I'm processing RPC requests in a Thrift service (though my question isn't Thrift-specific). What I want seems like it should be simple, but I can find no examples: how do I reuse com.google.inject.servlet.RequestScoped bindings…
Paul N
  • 41
  • 2
3
votes
1 answer

Cookie set in web filter is not available in request bean

I'm trying to create a localized JSF web application which allows user to select a language via dropdown. When language is selected, I simulate a redirect to the same page but with URL parameter: window.location.replace(urlToMyApp +…
peterremec
  • 488
  • 1
  • 15
  • 46
3
votes
1 answer

Will Kotlin coroutine always run on same thread? If not then how can we make it work with Guice Request Scope semantics?

Request scope enables us to track request wise variables throughout the request processing. But I think it depends on thread local variables. I assume using Kotlin coroutines will that break the Guice Injection of Request Scope semantics..
Dragonborn
  • 1,755
  • 1
  • 16
  • 37
3
votes
1 answer

Simple Injector: cannot register Web API controllers with AsyncScopedLifestyle

I am trying to integrate Simple Injector (4.0.12) in my .NET (4.6.1) Web API Project, but cannot find a way to register all Web API Controllers with the correct AsyncScopedLifestyle. When I try injecting an async scoped instance of DatabaseProvider…
3
votes
1 answer

Do @SessionScoped beans have concurrency issues?

Obviously, it's easy to have multiple parallel requests accessing the same @SessionScoped bean in a web app context. Am I correct in believing that I have to explicitly control synchronization when accessing the @SessionScoped bean within those…
user1050755
  • 11,218
  • 4
  • 45
  • 56
3
votes
1 answer

Pass a header value from web-tier to EJB with @RequestScoped bean?

I should pass some information coming with a HTTP header from a request to an EJB and I don't want to add parameters and pass them everywhere I need them. So i used a RequestScoped bean to hold my header values. Is this implementation ok, or do I…
Mathias Begert
  • 2,354
  • 1
  • 16
  • 26
2
votes
1 answer

Spring Boot: Unable to access the request scope bean in Spring Scheduler

In my Spring Boot application, i've a Scheduler task which executes for every one hour. In the scheduler method trying to access the request-scope bean. Always getting the exception org.springframework.beans.factory.BeanCreationException. Here is…
2
votes
1 answer

Request scoped bean exceptions and @ControllerAdvice

I have a custom Spring Boot AutoConfiguration class in which I’m creating a @RequestScoped bean of a custom class - Foo. In the same AutoConfiguration class, I’m creating a bean of my global exception handler which is a @ControllerAdvice. All these…
2
votes
1 answer

Request Scoped bean cannot use in Response body [Spring Boot]

I have a Request scoped(prototype) bean as a Response for a Rest Controller and getting Exception , not working I tried spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false on the property file as suggested by the error message "Type definition…
SandOfTime
  • 692
  • 6
  • 15
2
votes
0 answers

Camel REST service problem in parallel calls

I have created a REST service with Apache Camel (REST DSL) running on Karaf container that accepts a list of items and returns the availabilities of those them. The problem is that if the service is called in parallel it doesn’t return the correct…
2
votes
1 answer

JSP - All scopes are empty inside the jsp:include page

I want to put a variable in the requestScope so I can use it in an other page. Unfortunately, the requestScope is totally empty in this other page. In fact, when I print #{requestScope} in both pages, they don't have the same memory adresse…
Flyout91
  • 782
  • 10
  • 31
2
votes
1 answer

instanciation of a request scoped bean

A request scoped bean in spring means that the container create a single bean instance per HTTP request. Let say I have a RequestScopedBean bean : @Component public class RequestScopedBean { @PostConstruct void init() { …
iman
  • 145
  • 1
  • 4
  • 11
1
2 3 4