java - How configure Spring-Boot app to continue to use RestEasy? -


i have old web application (pure servlet, without spring) want run fat-jar. app provides lot of rest services. don't want modified old code.
how configure spring-boot app continue use resteasy?

you can use resteasy spring boot starter. here how it:

adding pom dependency

add maven dependency below spring boot application pom file.

<dependency>    <groupid>com.paypal.springboot</groupid>    <artifactid>resteasy-spring-boot-starter</artifactid>    <version>2.1.1-release</version>    <scope>runtime</scope> </dependency> 

registering jax-rs application classes

just define jax-rs application class (a subclass of application) spring bean, , automatically registered. see example below. see section jax-rs application registration methods in how use resteasy spring boot starter further information.

package com.test;  import org.springframework.stereotype.component; import javax.ws.rs.applicationpath; import javax.ws.rs.core.application;  @component @applicationpath("/sample-app/") public class jaxrsapplication extends application { } 

registering jax-rs resources , providers

just define them spring beans, , automatically registered. notice jax-rs resources can singleton or request scoped, while jax-rs providers must singletons.

further information @ project github page.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -