@FunctionalInterface public interface ComponentSource
Components
to an application.
This interface can be registered as a bean within a Spring Boot application in order to contribute components to the application. This interface can be registered as a lambda expression within the configuration class, for example:
@Configuration public class MyMetadataConfiguration { @Bean public ComponentSource myComponents() { return registry -> registry .add("items:list", getItemsList()); } private View> getItemsList() { // return items list view } }
Alternatively, if lambda expressions are not ideal, this interface can be implemented as a concrete class and then registered as a bean, for example:
@Configuration public class MyMetadataConfiguration { @Bean public ComponentSource myComponents() { return new MyComponentSource(); } public static class MyComponentSource extends ComponentSource { @Override public void register(ComponentRegistry> registry) { register.add("items:list", getItemsList()); } private View> getItemsList() { // return items list view } } }
Modifier and Type | Method and Description |
---|---|
void |
register(ComponentRegistry<?> registry)
Used for registering or modifying components within the
ComponentRegistry . |
void register(ComponentRegistry<?> registry)
ComponentRegistry
.registry
- the component registryCopyright © 2021. All rights reserved.