近日在使用zuul组件时,出现下面的异常:
java.lang.NullPointerException: null
at org.springframework.cloud.netflix.zuul.filters.SimpleRouteLocator.getRoutes(SimpleRouteLocator.java:72)
at org.springframework.cloud.netflix.zuul.filters.CompositeRouteLocator.getRoutes(CompositeRouteLocator.java:55)
at org.springframework.cloud.netflix.zuul.web.ZuulHandlerMapping.registerHandlers(ZuulHandlerMapping.java:102)
at org.springframework.cloud.netflix.zuul.web.ZuulHandlerMapping.lookupHandler(ZuulHandlerMapping.java:93)
at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.getHandlerInternal(AbstractUrlHandlerMapping.java:118)
at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:352)
翻看源码时, 其中模块spring-cloud-netflix的版本号为:1.3.0.RELEASE。类org.springframework.cloud.netflix.zuul.filters.SimpleRouteLocator 的代码如下:
public List<Route> getRoutes() { if (this.routes.get() ==