最近在考虑 功能模块 用spring的自注册。
所以看了看 Spring-boot的 actuator的自注册机制。
actuator的 web URL 入口是继承 MvcEndPoint声明的,这些EndPoint使用了@ConfigurationProperties 注解来注入配置,同时也在注册为 普通Bean。
所有的MvcPoint 由MvcPoints 收集:
Collection<MvcEndpoint> existing = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, MvcEndpoint.class) .values()
而 raw的EndPoint 则收集后用 EndpointMvcAdapter 包装
Collection<Endpoint> delegates = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, Endpoint.class) .values();
最后由EndpointWebMvcManagementContextConfiguration注册为
RequestMappingHandlerMapping