一个controller调用根据不同业务分发不同service
在一个项目中需要写很多的controller去调用不同的service,而写一个网关可以省去写controller层的痛苦。下面开始介绍可以分发不同service。1.因为service在项目启动时就已全部注入到spring容器中,所以我们需要写一个工具类,可以从spring上下文(applicationContext)中获取到对应service@Componentpublic c...
原创
2019-10-18 17:29:14 ·
6546 阅读 ·
4 评论