Is there a way to register a JAX-RS Provider in Quarkus application.properties? - jax-rs

I'm trying to register a class that implements javax.ws.rs.core.Feature in my Quarkus application. I understand that using #Provider annotation on the class should do it but this class is contained in an external jar so that's not an option. I want to avoid having to extend javax.ws.rs.core.Application and return my Feature implementation from getClasses(). Is there a property I can set in application.properties to register this Feature implementation?

No, you can't do that.
However, you can make Quarkus look for #Provider classes in the external JAR. See this for more details

Related

Quarkus Jax-rs clients with external interfaces

I started playing around with Quarkus and its REST client. According to the documentation a Jax-RS annotated interface should be created and annotated further with #RegisterRestClient.
My issue is that I already have the JaxRS interfaces for the services I need to connect to, in an artifact provided by the server, which I can just import. Is there a way to use an already created external Jax-RS interface to create a service with? It seems so wrong to copy-paste the code for a perfectly good interface, when it has been so nicely served for me.
There's RestClientBuilder, which allows programmatic usage of JAX-RS interfaces. Assuming the JAX-RS interface is called HelloClient, you can do this:
HelloClient client = RestClientBuilder.newBuilder()
.baseUri(URI.create("http://localhost:8080"))
.build(HelloClient.class);

JAX-RS EJB container

I have an .jar application (using ejbs) deployed as part of an .ear archive.
Inside this .jar application I have classes annotated with #Path and #Stateless.
My question is: Are my JAX-RS resources going to be deployed inside an EJB container or inside WEB (Servlet) container? Do I need to define web.xml and to put servlet definition inside of it?
Are my JAX-RS resources going to be deployed inside an EJB container or inside WEB (Servlet) container?
It will be deployed to the servlet container of your EE server.
Do I need to define web.xml and to put servlet definition inside of it?
Not necessarily. You can configure a JAX-RS application simply by having an empty Application subclass annotated with #ApplicationPath1.
#ApplicationPath("/api")
public class RestApplication extends Application {}
If you want to use a web.xml, you can instead of this class. If you do want to, just look for a tutorial to show you how to do it. But this class is all that is needed for the most basic configuration.
Footnotes
See How to use Jersey as JAX-RS implementation without web.xml?

How to do dependency injection in a WCF application

I have an IIS-hosted WCF application. Right now the service has this constructor:
public ClassService()
: this(new ClassRepository())
{
}
public ClassService(IClassRepository repository)
{
_Repository = repository;
}
The parameterless constructor is because WCF requires you to have a parameterless constructor when generating service proxies. Now, when I have the service proxy in the UI assembly, the constructor with the IClassRepository is not present so I can't inject an implementation of the repository.
How is this commonly done? One idea I have is that injection would take place not in the UI but in the Service but I am not sure if this would have some repercussions or just plain bad. Can someone give me some ideas?
What you need to do is implement a WCF InstanceProvider, delegating creation requests to your container of choice. Once you have your instance provider coded, you can install it in a ServiceHost by implementing a WCF service behavior. The service behavior, in turn, is installed by adding it to the collection ServiceHostBase.Description.Behaviors.
Here's an MSDN Magazine article on WCF extensibility.

Spring Data repository proxy Pointcut on Annotation

I know generally you cannot execute a pointcut based on an annotation that was made on an interface, but is there anyway to do this with Spring Data Repository Proxies?
I have custom annotations for caching and make use of AOP to intercept certain methods and cache values, very similar to how Ehcache works.
Is there any way to use these annotations with a Spring Data Repository?

WCF WinService with Plugins

I have a win32 application that uses client side plugins and uses a Win32 Service via TCP/IP. I would like to also dynamically load assemblies on the WCF service based on the addition of new plugins. Currently I have to add the the ServiceContract and OperationContract to the Services class and IService interface and then re-compile. Is there a way to dynamically load the WCF assemblies and not have to generate the class and interface references? Can these be moved out of the WCF Win32 service into external classes?
I was wondering about this as well, but came to the conclusion that this was not a question of whether or not its possible, but should you do it? Even if you could generate the contract definitions dynamically, you still need to notify the client of the change, they in turn would need to regenerate the proxy in order to interact with the new service definition, and then provide an implementation dynamically. A better approach is to redesign your service so it implements a particular strategy (read Strategy pattern). The contract remains static, but the implementation changes based on client input. That way your service can dynamically load modules without your client being aware of it.
HTH.
Steve