'RequestScoped objects don't seem to be reinitialized for new requests
This is the request scoped object. Also tried without the RequestScopeContext not being request scoped but just the attributes within it request scoped. Also tried with @Inject rather than @Produces.
@RequestScoped
public class RequestScopeContext {
@Produces
@RequestScoped
MessageHandlerContext messageHandlerContext = new MessageHandlerContext();
@Produces
@RequestScoped
MessageUtilCache messageUtilCache = new MessageUtilCache();
}
Tried these with @Inject as well as @Produces.
To be used by
@Provider
@ApplicationScoped
public class InterceptorServer {
private static final String INSTRUCTION_TYPE_REQUEST = "REQUEST";
private static final String INSTRUCTION_TYPE_RESPONSE = "RESPONSE";
private static final String CONFIG_TYPE_FILTER = "FILTER";
private static final Logger LOGGER = LoggerFactory.getLogger(InterceptorServer.class);
@Inject
RequestScopeContext requestScopeContext;
@Inject
MessageUtilConfigurations messageHandlerConfigurations;
@RouteFilter(1)
void messageHandlerServerFilter(RoutingContext routingContext) {
Also tried with @Inject @Produces RequestScopeContext requestScopeContext; Also tried with @Inject @RequestScope RequestScopeContext requestScopeContext; Also tried with @Produces @RequestScope RequestScopeContext requestScopeContext;
In all cases either the combinations of annotations weren't accepted or the MessageUtilCache still had values from previous requests.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
