Package com.vaadin.flow.spring
Class VaadinServletContextInitializer
java.lang.Object
com.vaadin.flow.spring.VaadinServletContextInitializer
- All Implemented Interfaces:
org.springframework.boot.web.servlet.ServletContextInitializer
public class VaadinServletContextInitializer
extends Object
implements org.springframework.boot.web.servlet.ServletContextInitializer
Servlet context initializer for Spring Boot Application.
If Java application is used to run Spring Boot then it doesn't run registered
ServletContainerInitializers (e.g. to scan for Route
annotations in the classpath). This class enables this scanning via Spring so
that the functionality which relies on ServletContainerInitializer
works in the same way as in deployable WAR file.
- Since:
- 10.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionVaadinServletContextInitializer(org.springframework.context.ApplicationContext context) Creates a newServletContextInitializerinstance with applicationcontextprovided. -
Method Summary
Modifier and TypeMethodDescriptionfindClassesForDevMode(Set<String> basePackages, List<Class<? extends Annotation>> annotations, List<Class<?>> superTypes) Scans the given packages for the classes development mode needs, which is a wider set than what a production build scans for.voidonStartup(jakarta.servlet.ServletContext servletContext)
-
Constructor Details
-
VaadinServletContextInitializer
public VaadinServletContextInitializer(org.springframework.context.ApplicationContext context) Creates a newServletContextInitializerinstance with applicationcontextprovided.- Parameters:
context- the application context
-
-
Method Details
-
findClassesForDevMode
protected Set<Class<?>> findClassesForDevMode(Set<String> basePackages, List<Class<? extends Annotation>> annotations, List<Class<?>> superTypes) Scans the given packages for the classes development mode needs, which is a wider set than what a production build scans for.- Parameters:
basePackages- the packages to scanannotations- the annotations a matching class is annotated withsuperTypes- the types a matching class extends or implements- Returns:
- the classes found, never
null - Since:
- 24.5
-
onStartup
public void onStartup(jakarta.servlet.ServletContext servletContext) throws jakarta.servlet.ServletException - Specified by:
onStartupin interfaceorg.springframework.boot.web.servlet.ServletContextInitializer- Throws:
jakarta.servlet.ServletException
-