60 questions
0
votes
0
answers
109
views
Why am I getting different @RequestScope bean instances in my Filter vs. Controller?
I've just upgraded to Micronaut 4 and Java 21 and I'm trying to share state between a HttpServerFilter and a Controller using a @RequestScope bean. My goal is to set some summary information (like a ...
1
vote
0
answers
107
views
NestJS Request Scope service causing context loss in unrelated service
I'm trying to understand a little more about the affect of having request-scoped classes in the pipeline of a Nest application. I have had the need to introduce 'local storage' to the REST API I am ...
0
votes
1
answer
153
views
How to regularly trigger its own endpoint?
I have an existing endpoint calling some function, and it works fine when doing a rest call to the endpoint. Then I want to create a scheduler that will call that function regularly. The scheduler ...
1
vote
1
answer
4k
views
Quarkus - ContextNotActiveException when injecting a request scoped bean in Interceptor
I've got a Quarkus application. The entry point to trigger this application is a class which implements AWS RequestHandler.
Before it runs I would like to set the context depending on the given ...
0
votes
0
answers
360
views
Request-scoped bean is available in @RestController but throws ScopeNotActiveException in HttpFilter
Recently I've run into an issue regarding request-scoped beans. Here's the code:
@Configuration
class PreAuthorizationHttpHeaderFilterConfig {
@Bean
JwtPreAuthorizationConfigurer ...
0
votes
1
answer
2k
views
@RequestScope vs ThreadLocal for mutlti tenant in Quarkus with Mutiny?
I have a multitenant Quarkus application. For each process, I need to store context information about the tenant that owns the process. This information is necessary for the HibernateTenantResolver ...
1
vote
0
answers
285
views
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 <T> Future<T> submit(Callable<T> task) {
return super....
0
votes
1
answer
3k
views
NestJS ModuleRef instances
I'm relatively new to nestJS and ran into a circular dependency with REQUEST Scoped services that got me reading about ModuleRef in nestJS.
I was looking at the documentation where it mentions that ...
2
votes
1
answer
8k
views
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 ...
1
vote
0
answers
234
views
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': ...
0
votes
0
answers
387
views
Converting Request scoped bean to JSON string
I was facing an issue while converting a bean with request scope to JSON using object mapper. It thows an exception like below. Not sure what am missing. I couldn't find any relatable resource on the ...
11
votes
2
answers
6k
views
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 ...
3
votes
1
answer
3k
views
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....
1
vote
1
answer
3k
views
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 ...
3
votes
1
answer
428
views
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:
...
0
votes
1
answer
66
views
How can I get the value of an object inside an object by requestscope? [closed]
I have many children of class object inside a big class object. I have set value for those child object and I want them to be printed in my jsp page through request scope. How do I implement this in ...
1
vote
2
answers
4k
views
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 ...
2
votes
1
answer
6k
views
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 ...
0
votes
1
answer
1k
views
How to send request scope bean as response in Spring Boot
I would need to send the response which also consists of request information as well. Tried with the following code but getting below exception:
@Component
@Scope(value = "request", proxyMode = ...
0
votes
1
answer
2k
views
Implement runnable to serve a new request in springboot
I have a usecase in a spring boot application, where in we get a request, we send an acknowledgement back and then start a new executor task in background which will do some processing and send back ...
0
votes
0
answers
1k
views
Spring: How does a request scoped bean behave inside a asynchronus method call
Im working with Spring Boot 2.2.4.
I have the following class, where Client is a request scoped bean:
@AllArgsConstructor
@Component
public class CacheLoader {
private Client client;
@Async
...
3
votes
1
answer
1k
views
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 ...
0
votes
1
answer
418
views
How to cache OAuth2RestTemplate with a cusom grant_type in Spring Boot?
I have seen similar threads but mine is different in that I am using a custom grant type. To give you a background, when we call a micro-service from another one, we use a delegation token that has ...
1
vote
1
answer
2k
views
@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;...
1
vote
0
answers
759
views
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 @...
0
votes
1
answer
2k
views
Calling a class annotated with @RequestScope inside a Listener using Spring boot
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'scopedTarget.movimentacaoEntradaRadarNotaBuilderImpl': Scope
'request' is not active for the current ...
1
vote
0
answers
33
views
What should be the scope of AmazonS3Client object in a web application? [duplicate]
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 ...
0
votes
0
answers
62
views
Why is separate RequestScoped bean not injected into the bean called by JSF commandButton action?
For what reason won't an injected secondary bean using the same scope contain the form data from the submit? Using an explicit method call with parameter from a (JSF) commandButton action..
I've ...
1
vote
1
answer
203
views
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 ...
0
votes
1
answer
3k
views
@Timed annotation does not work with request scoped beans?
I have a bean that has a request scope and in it there is a method that is annotated with micrometer(io.micrometer.core.annotation) @Timed but it is not showing in the metrics. It shows if the bean ...
8
votes
2
answers
6k
views
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 ...
2
votes
1
answer
658
views
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 ...
4
votes
1
answer
1k
views
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 ...
0
votes
0
answers
26
views
Is it possible to access RequestScoped class from Singleton class?
I have one Singleton class in my Primefaces Webapp, where I want to query one parameter from my database (for the logged in user). This parameter access function is in other class and this isn't ...
2
votes
0
answers
726
views
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 ...
0
votes
0
answers
5k
views
Spring Autowire Request Scope
In Spring it's easy to autowire beans and have them available anywhere in the app context. Beans can be specialized to a scope such as session/request/web socket etc.
I have a rather unique scenario. ...
-1
votes
1
answer
1k
views
Spring Boot How can i easy Scope Request bean in Async method?
Spring boot
How can i easy use bean with Request Scope in async method.
When i try execute got exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bean ...
0
votes
1
answer
3k
views
How to scrape javascript text using beautifulsoup
I am trying to get the text produced as a result of an external script in html with Python:
<td class="headerlast item" rowspan="2" colspan="1" id="Party_ATP021_1">
<div id="Party_ATP021mod"&...
3
votes
1
answer
2k
views
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 ...
2
votes
1
answer
448
views
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, ...
3
votes
1
answer
317
views
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 ...
1
vote
0
answers
136
views
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 =...
1
vote
1
answer
380
views
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 ...
1
vote
1
answer
4k
views
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 ...
4
votes
1
answer
2k
views
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....
5
votes
1
answer
2k
views
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 (...
1
vote
1
answer
754
views
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 ...
1
vote
1
answer
329
views
How does spring come to know about the new request or session?
I know in a web application, for every request it gets, spring creates a new instance of the bean in ints container.
I want to know how does spring differentiate between the requests and create new ...
-1
votes
1
answer
359
views
Symfony: How to handle common request scope data
I'm migrating a legacy PHP project (pre-OO) to Symfony2. On every request I have to:
compute some dynamic data (depending on the current date and/or some request parameter)
use that data (multiple ...
0
votes
0
answers
61
views
"No saved view state could be found..." after doubleclick on logout [duplicate]
I have an application with a logout button. After I doubleclick the button, I get a ViewExpiredException:
An unexpected exception was caught during processing the request:
javax.faces.application....