/** * Return all {@link MvcEndpoints} from the management context. * @return {@link MvcEndpoints} from the management context */ public MvcEndpoints getMvcEndpoints() { try { return getApplicationContext().getBean(MvcEndpoints.class); } catch (Exception ex) { return null; } }
private String getConfiguredPath() { if (MvcEndpoint.class.isAssignableFrom(this.endpointClass)) { return ((MvcEndpoint) this.context.getBean(this.endpointClass)).getPath(); } for (MvcEndpoint endpoint : this.context.getBean(MvcEndpoints.class) .getEndpoints()) { if (endpoint instanceof EndpointMvcAdapter && this.endpointClass .isInstance(((EndpointMvcAdapter) endpoint).getDelegate())) { return ((EndpointMvcAdapter) endpoint).getPath(); } } throw new IllegalStateException( "Could not get configured path for " + this.endpointClass); }
@Autowired public void handlerMapping(MvcEndpoints endpoints, ListableBeanFactory beanFactory, EndpointHandlerMapping mapping) { // In a child context we definitely want to see the parent endpoints mapping.setDetectHandlerMethodsInAncestorContexts(true); postProcessMapping(beanFactory, mapping); }
LinksEnhancer(String rootPath, MvcEndpoints endpoints) { this.rootPath = rootPath; this.endpoints = endpoints; }
@Bean @ConditionalOnMissingBean public MvcEndpoints mvcEndpoints() { return new MvcEndpoints(); }
@Autowired public void handlerMapping(MvcEndpoints endpoints, ListableBeanFactory beanFactory, EndpointHandlerMapping mapping) { // In a child context we definitely want to see the parent endpoints mapping.setDetectHandlerMethodsInAncestorContexts(true); }