4 Aralık 2023 Pazartesi

SpringMVC SpringServletContainerInitializer

Giriş
Şu satırı dahil ederiz
import org.springframework.web.SpringServletContainerInitializer;
Açıklaması şöyle. Yani Tomcat ServletContainerInitializer arayüzünü gerçekleştiren sınıflar arıyor. Bu sınıflardan bir tanesi de SpringServletContainerInitializer
Tomcat is searching for ServletContainerInitializer class at all the jar files included in the project if available. This class has to be stored exactly inside javax.servlet.ServiceContainerInitializer file which is placed in META-INF/services directory in each jar file.
Kalıtım şöyle
@HandlesTypes(WebApplicationInitializer.class)
public class SpringServletContainerInitializer implements ServletContainerInitializer {
Açıklaması şöyle. Yani  jakarta.servlet.annotation.HandlesTypes anotasyonu ile jakarta.servlet.ServletContainerInitializer gerçekleştirimi hangi arayüzler ile ilgilendiğini Tomcat'e bildirir
In the ServletContainerInitializer, there is an annotation assigned called @HandlesTypes. The implementer can assign any class for it and Tomcat searches all the classes that have been extended or implemented to the assigned class. 
Böylece WebApplicationInitializer başlatılır

Hiç yorum yok:

Yorum Gönder