which better between calling a servlet init method or implementing servlet context listener when we have to set some data on application startup.
The servlet context listener is made for that. Use it. You could use a servlet, but you would have to make sure it's started at deploy time, and before other servlets. And which one of all your servlets would have this responsibility?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With