Interface AbstractLookupInitializer
-
- All Known Implementing Classes:
LookupInitializer
public interface AbstractLookupInitializerSPI for customizing lookup in applications inside Servlet 3.0 containers.There are two ways of customizing Lookup in various servlet containers:
- Use
AbstractLookupInitializerSPI via providing an implementation for the framework which doesn't preventLookupServletContainerInitializerexecution. - Completely disable
LookupServletContainerInitializerand implement own way to set upLookupand make it available viaVaadinContext.getAttribute(Class).
Lookupcreation and initialization in case when it's not possible to preventLookupServletContainerInitializerexecution (any container which completely supports Servlet 3.0 specification). In this case it's possible to implementAbstractLookupInitializerfor the framework.The second case is only possible when a servlet container doesn't run
ServletContainerInitializers out of the box (e.g. OSGi or Spring boot executed as a Jar) at all. Otherwise you may not disable an existingServletContainerInitializerand it will be executed anyway.This is SPI for
LookupSPI. The difference is:Lookupallows to override services per Web application (by the application developer). For some service interfaces there can be several implementations available inLookup.AbstractLookupInitializerallows to override how theLookupworks per framework. The default implementation available if no framework is used. Only one service implementation (excluding the default one) may be available in the web application classpath and it's provided by the developers for the framework support (the main usecase here is Spring add-on).
- Since:
- Author:
- Vaadin Ltd
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidinitialize(VaadinContext context, Map<Class<?>,Collection<Class<?>>> services, VaadinApplicationInitializationBootstrap bootstrap)Creates a newLookupinstance, initializes it and passes it to the providedbootstrap.
-
-
-
Method Detail
-
initialize
void initialize(VaadinContext context, Map<Class<?>,Collection<Class<?>>> services, VaadinApplicationInitializationBootstrap bootstrap) throws javax.servlet.ServletException
Creates a newLookupinstance, initializes it and passes it to the providedbootstrap.The method should creates a new initialized
Lookupinstance. In some cases it's not possible to create the instance right away when the method is called. To be able to support this usecase the method contract doesn't require to return theLookupinstance. Instead the created instance should be passed to the providedbootstrapconsumer once the instance is created and completely initialized. Thebootstrapwill start the application initialization which otherwise is postponed until aLookupbecomes available.The implementation must use the provided
bootstrapto pass theLookupinstance otherwise the web application based on thisLookupInitializerwill never be bootstrapped.The provided
servicesmap contains service implementations found in application classpath using@HandlesTypesannotation declared forLookupServletContainerInitializer.- Parameters:
context- a Vaadin context to run initialization forservices- the map of internal services with their implementations found in the application classpathbootstrap- the web application bootstrap- Throws:
javax.servlet.ServletException- if initialization failed
-
-