- A basic guide using spring boot in scala combine swagger
- Update jdk version to 1.8, for using lambda
- Action can return the rx.Observable, like return Callable Or DeferredResult see the RxJavaController
- When controller return Callable/DeferredResult/Observable, Support MDC value to deliver
why this using maven not sbt,just for convenient because we can inhert 'spring-boot-starter-parent', so everything we no need to care the jar version. also it is ok for using sbt to manage the package.
- aop, around every request and response
- config, deploy the property for app
- controller, handle the request and return response
- exception, where to handle overall exception
- utils, some useful function, like distribute lock and expend method
-
ProtostuffHttpMessageConverter
使用io.protostuff来进行数据传输
-
ObservableReturnValueHandler
继承AsyncHandlerMethodReturnValueHandler类, 使spring mvc可以返回Observable<?>类型, 这样可以避免web server的连接池被占用而引起性能问题,增加服务器的吞吐量
-
MDCSimpleAsyncTaskExecutor/MDCCallableProcessingInterceptor/MdcPropagatingOnScheduleAction
像spring mvc返回Callable/DeferredResult等类型时,本质上都是为了避免web server线程池被占用,利用非web的服务线程来处理,这个时候如果我们使用了slf4j中的MDC类时或者jdk的threadlocal时, 我们需要将请求线程中的一些数据给传递下去, 像traceid这种全链路调用标识符, 那我们就需要扩展CallableProcessingInterceptorAdapter跟DeferredResultProcessingInterceptorAdapter这类型, 在线程执行前后将当前线程的数据给传递到新起来的线程中
-
others
如果是spring cloud中, 那我们也可以在跟其它服务进行交互时重写一些, 像feignClient中的RequestInterceptor拦截器, 在这添加我们自己的特殊处理