java - How could Spring find his classes in a project? -


probably trivial , nonsense question but, being spring neophyte, i've asked myself "how spring can use classes in project extends classes?"

for example abstractannotationconfigdispatcherservletinitializer:

public class initializer extends abstractannotationconfigdispatcherservletinitializer  {      @override     protected class<?>[] getrootconfigclasses() {      }  } 

my initializer class it's declared in hand-built package non special name wonder: how spring find , instantiates initializer class? make sort of "package scan" of project trying classes extends own, or something?

the servlet container scans classes of webapp @ deployment time. allows auto-register classes annotated @webservlet servlets, classes annotated @webfilter servlet filters, etc.

it allows if find classes implementing javax.servlet.servletcontainerinitializer, , call onstartup() method, allows initializer register servlets , filters dynamically. spring class springservletcontainerinitializer such class, in turn delegates own initializer.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -