use of com.blade.mvc.route.RouteMatcher in project blade by biezhi.
the class NettyServer method initIoc.
private void initIoc() {
RouteMatcher routeMatcher = blade.routeMatcher();
routeMatcher.initMiddleware(blade.middleware());
routeBuilder = new RouteBuilder(routeMatcher);
blade.scanPackages().stream().flatMap(DynamicContext::recursionFindClasses).map(ClassInfo::getClazz).filter(ReflectKit::isNormalClass).forEach(this::parseAndCreate);
routeMatcher.register();
this.loaders.stream().sorted(new OrderComparator<>()).forEach(b -> b.preLoad(blade));
this.processors.stream().sorted(new OrderComparator<>()).forEach(b -> b.preHandle(blade));
Ioc ioc = blade.ioc();
if (BladeKit.isNotEmpty(ioc.getBeans())) {
log.info("{}Register bean: {}", getStartedSymbol(), ioc.getBeans());
}
List<BeanDefine> beanDefines = ioc.getBeanDefines();
if (BladeKit.isNotEmpty(beanDefines)) {
beanDefines.forEach(b -> {
IocKit.initInjection(ioc, b);
IocKit.injectionValue(environment, b);
List<TaskStruct> cronExpressions = BladeKit.getTasks(b.getType(), environment);
if (null != cronExpressions) {
taskStruts.addAll(cronExpressions);
}
});
}
this.loaders.stream().sorted(new OrderComparator<>()).forEach(b -> b.load(blade));
this.processors.stream().sorted(new OrderComparator<>()).forEach(b -> b.processor(blade));
}
Aggregations