Questions tagged [requestscope]

57 questions
2
votes
0 answers

JSF bean creates more than once

When I open jsf page then catalog bean creates two times. So why does it happen? jsf page:
rozerro
  • 5,787
  • 9
  • 46
  • 94
1
vote
0 answers

Springboot | RequestScope | @Async | Is their any way to identify that request is executing through Async thread OR main thread?

I'm facing issue where, sometimes, async thread is NOT copying Request Scope properties through : @Override public Future submit(Callable task) { return super.submit( new ContextAwareCallable(task,…
1
vote
1 answer

How does RequestScope in Quarkus/CDI work?

I did some experimentation with Quarkus and I am having difficulties understanding how @RequestScoped works. Coming from Spring, I would be expecting that the following code should not work and throw an Exception: @ApplicationScoped public class…
Dave
  • 420
  • 1
  • 3
  • 14
1
vote
0 answers

How to use request scoped bean in a reactor framework async call?

Not able to use request scoped bean in a reactor code. Facing the below exception org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.eventProcessor': Scope 'request' is not active for the current…
Kratos_001
  • 11
  • 1
1
vote
1 answer

Spring Boot Request Scoped Bean

I am using spring boot for creating microservices. I need to implement request scope beans as I get some information in header and need this to be available across all the classes for that particular request. Below is what I did, but I get null…
Lolly
  • 34,250
  • 42
  • 115
  • 150
1
vote
2 answers

micronaut @RequestScope - not creating bean per incoming http-request

I have a class the following class as RequestScope bean: @RequestScope class RequestContext { private String requestId; private String traceId; private String authorisedId; private String routeName; // few more fields @Inject…
Sreerag
  • 1,381
  • 3
  • 11
  • 16
1
vote
1 answer

Spring bean RequestScope with Webflux

Is there a pattern to use @RequestScope with Webflux? We used the approach suggested here (https://www.baeldung.com/spring-bean-scopes) but it gives below error. No scope registered for scope name request
user12842828
  • 31
  • 1
  • 5
1
vote
1 answer

@RequestScope annotation behaviour with Java inheritance

Lets say we have a class @RequestScope public abstract class A { int a; } and another class which extends the above class @Service public class B extends A { public int getA () { return a; } } Is this class B's variable (that it is…
1
vote
0 answers

Dependency Injection vs Request Scope

I have an Spring Rest application, in which there's a requirement to get some access token in a service(Annotated with @Service) class. The token generation is in a separate class(Annotated with @Component) and the requirement given is to get a…
Rajesh2389
  • 349
  • 2
  • 15
1
vote
0 answers

What should be the scope of AmazonS3Client object in a web application?

I want to use AWS SDK for .Net to read and write to an S3 bucket, from a web application. What should be the scope of AmazonS3Client client? Looking at ASW sample code they are using a static s3Client: private const string bucketName = "*** provide…
Hooman Bahreini
  • 14,480
  • 11
  • 70
  • 137
1
vote
1 answer

How to test a Ninject Factory returns the same instance in RequestScope

In a WebApi application, I am using Ninject to inject a factory that allows consuming classes to create a DbContext that is scoped according to their requirements. I want to be able to write a unit test that verifies that two calls to the same…
Paul Taylor
  • 5,651
  • 5
  • 44
  • 68
1
vote
0 answers

Can two stateless EJB's share the same request scoped entity manager?

I've decided to use a request scoped container managed EntityManager and I've created a producer for that reason: @RequestScoped public class EntityManagerProducer { @PersistenceContext(unitName = "PU", type =…
Daniel Rusev
  • 1,331
  • 2
  • 16
  • 35
1
vote
1 answer

Guice Request Scope for tracing workflow of request

I have a use case where I have 6 steps being performed in one request. The business is requesting that we capture metrics on what the result of each step was in the process. They want us to log to a Kinesis stream. Architecturally I am looking at…
Scoota P
  • 2,622
  • 7
  • 29
  • 45
1
vote
1 answer

How to inject request scoped bean?

I want to inject my request scoped bean to my other bean. @Component @Scope(value = WebApplicationContext.SCOPE_REQUEST) public class UiCtx { @Autowired(required = true) private ApplicationContext ctx; @Autowired(required = true) …
Damian
  • 2,930
  • 6
  • 39
  • 61
1
vote
1 answer

Spring - Request scoped bean from object pool

I have an object pool of resources: public interface PooledResource { ... } @Component public class ResourcePool { public PooledResource take() { ... } public void give(final PooledResource…
Dave Jeod
  • 37
  • 5