Selectors with Injection - ngxs

Is possible to inject some service within a selector in NGXS? Since its static I'm not sure how. I know probably it should be avoided but in certain cases injecting a service such as logger or config can be useful and I'm not sure if this can be done.
Checked several docs but didn't find any yet. Any help would be appreciated, thanks.

Related

Is it ok to merge swagger interface into the controller?

Looking for best practice suggestions with swagger interface. SO my lead suggests doing away entirely with the swagger interface and instead having all the swagger annotations within the Controller itself. Is this good practice or otherwise ?
This is borderline opinion-based, but yes it is ok. Some people might tell you that they prefer to have all Swagger-related annotations in an interface and others might tell you they prefer to have it directly in the Controller code. I usually have them directly in the Controller code. The only reasons to have them in an interface are to make it simpler to remove it if we ever need to and to keep concerns segregated, but let's face it how many times did you remove Swagger from a service after adding it the first time? Nevertheless, both options are ok.

Websphere/Open-Liberty: Access to Weld-Internal classes

I am fully aware that this might not be a good idea in general, but I am wondering if there is a way to access Weld-internal classes from my deployed application-war.
E.g. org.jboss.weld.resources.ClassTransformer
This is not for a production-app but rather for a side-projected related to testing and loading some CDI beans on the fly and performing proper cleanup.
The code I have is working under Wildfly, but fails with java.lang.NoClassDefFoundError: org.jboss.weld.resources.ClassTransformer. I am certain that the weld implementation/feature has this class.
For sure, this is by design, but I am wondering if there is still a way to achieve it; maybe via configuration to not enforce this strict classloader isolation...
Again, this is only for a very specific testing/development scenario.
Thanks,
Daniel

How correctly add RetryAdvice to Jms.messageDriverChannelAdapter

I'm very new to Spring Integration DSL and I need to add retrial with recovery to the existing IntegrationFlow. It takes data from Jms.messageDriverChannelAdapter and send it through different channels. I want to add RequestHandlerRetryAdvice for the whole flow.
My idea was to add it to the adapter, but it seems to support only ErrorChannel, without Advices & Retries and such. I've ended up wrapping the whole flow after Jms.messageDriverChannelAdapter in a .gateway with advice and .requireReply(false). It feels like a hack, but I couldn't find a better way to do it. Is there any better way to deal with such situation?
Unlike Spring AMQP's listener container a JMS one doesn't provide a hook to inject Advice chain into it, so, we really don't have choice and workaround it somehow. The RequestHandlerRetryAdvice and a .gateway() DSL is not so bad idea to go. The point is that a RequestHandlerRetryAdvice is applied only for the particular handleRequestMessage() method and is not propagated downstream. Having the flow wrapped into the gateway call from the mentioned handleRequestMessage() is the way to go.
I think we can come up with the solution on the JmsMessageDrivenEndpoint to wrap an internal listener with injected Advice chain, where one of them might be a RetryOperationsInterceptor.
Please, raise a GH issue and we'll think what we can do.

ehcache restful service methods override/extend

my question may be vague to ask. I am trying to use ehcache restful service methods such as get or put. I am not sure how this works under hood, is there any way I can override these methods? I mean, get always looks up in cache, but I want to look up in database if not found in cache. I can implement this behavior by writing my own rest service methods, but is there anyway to use ehcache built-in rest functionality by overriding their methods or extend their methods to look up in database if not found in cache. Appreciate your help, thanks.

Why Spring's ReflectionUtils marked as "Only intended for internal use"?

Can I use this library? Or is it not desirable? And why?
I was trying to find answer, but have found nothing about this warning.
If usage of this library is not good idea, may be you will able to advise me another library.
Thanks for advance!
You can use it and I think the chances of Spring changing it are quite small, but there's no concrete intention from the Spring development team to keep that class as it's, as opposed to what they do with their public/non-internal APIs.
So if it changes in the future, the spring guys won't be accepting any complains of the type 'but my code depends on that class and you change it!.

Resources