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
Post a Comment