Tag: jax rs

使用kotlin在Spring Boot中自定义Jersey ExceptionMapper

我无法用Spring Boot和Kotlin注册一个自定义的ExceptionMapper。 @Configuration @ApplicationPath(“/api”) class JerseyConfig : ResourceConfig() { init { register(JWTAuthExceptionMapper::class.java) .register(GsonProvider::class.java) .register(PingResource::class.java) .register(AuthResource::class.java) } } 映射器: import org.springframework.stereotype.Component import javax.ws.rs.core.Response import javax.ws.rs.ext.ExceptionMapper import javax.ws.rs.ext.Provider @Provider @Component class JWTAuthExceptionMapper() : ExceptionMapper { override fun toResponse(exception: JWTAuthException?): Response { return Response.status(Response.Status.UNAUTHORIZED).entity(exception?.message).build() } } JWTAuthException不调用toResponse方法。 我想念什么?

Kotlin REST改为打字稿定义

大家好, 我在JAX-RS中有一个使用REST api编写的项目。 我想使用maven任务来生成相关的打字稿API与定义的DTOs。 我发现项目https://github.com/raphaeljolivet/java2typescript ,这似乎是完美的,实际上这并不能满足所有需要。 你知道一些其他的发电机根据REST API生成REST和DTO吗? 非常感谢您的帮助和讨论