我在我的feign.builder()
中声明了Stepdefs.class
三遍
是否有减少代码行数的方法?
即时消息是我自己学习的,因此如何使以下代码更可重用。
Interface.PostComment postComment = Feign.builder()
.client(new OkHttpClient())
.encoder(new JacksonEncoder())
.decoder(new JacksonDecoder())
.logger(new Slf4jLogger(Interface.PostComment.class))
.logLevel(Logger.Level.FULL)
.target(Interface.PostComment.class, "http://localhost:3000/comments/");
Interface.DeleteComment deleteComment = Feign.builder()
.client(new OkHttpClient())
.encoder(new JacksonEncoder())
.decoder(new JacksonDecoder())
.logger(new Slf4jLogger(Interface.DeleteComment.class))
.logLevel(Logger.Level.FULL)
.target(Interface.DeleteComment.class, "http://localhost:3000/comments/" + id );
Interface.UpdateComment updateComment= Feign.builder()
.client(new OkHttpClient())
.encoder(new JacksonEncoder())
.decoder(new JacksonDecoder())
.logger(new Slf4jLogger(Interface.UpdateComment.class))
.logLevel(Logger.Level.FULL)
.target(Interface.UpdateComment.class, "http://localhost:3000/comments/" + id);