sofastack / sofa-jarslink

Jarslink is a sofa ark plugin used to manage multi-application deployment
Apache License 2.0
3.04k stars 706 forks source link

controller 放到模块里,requestMapping 没有生效,有解决方案么? #57

Closed fordCheng closed 6 years ago

fordCheng commented 6 years ago

controller 放到模块里,requestMapping 没有生效,有解决方案么?

liangruisen commented 6 years ago

controller 放到模块里,requestMapping 没有生效是因为模块扫描类之后没有将requestMapping注册到RequestMappingHandlerMapping类里面导致的。解决思路是利用反射的方式调用RequestMappingHandlerMapping对象的保护级 detectHandlerMethods 方法来注册 controller 对象,只是这样做了之后模块运行时卸载就会出现问题,尚未想到运行时卸载干净模块的方法。注:这个思路尚未进行验证。