I think something is wrong here.
I have a simple one servletwith a static block that prints some kind of message. So, as far as I understand, the static block should be processed when the servlet class is first loaded into jvm.
I use the built-in jettyand start the berth server with the -verbose:classjvm option .
I see in the output that the class is servletloaded long before I first access this servlet and see the messages.
But, as far as I know, a static block should be initialized immediately after loading the class. Where am I wrong here?
source
share