Q:

Bare bones servlet application, where to store config settings that I can reference?

I have a bare bones servlet application.
Do I store config related information in my web.xml file?
Is there an event that fires in my servlet that I should save the config value to to a static readonly variable?
I have a single servlet right now, but is there another file where the lifecycle begins at a global level?
Like in .net, you have your pages, but there is a global.asax.cs class that fires at specific events like:
application_startup
application_shutdown
application_beginRequest
application_endRequest

Does servlets have this, or is it on a per-servlet basis?

A:

application_startup
application_shutdown

Implement ServletContextListener.
@WebListener
public class ApplicationListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent event) {
        // Do your job here on application startup.
    }

    @Override
    public void contextDestroyed(ServletContextEvent event) {
        // Do your job here on application shutdown.
    }

}

You can store application wide variables as an attribute of the ServletContext.
event.getServletContext().setAttribute("foo" new Foo());

It's available in servlets by the inherited getServletContext() method.
Foo foo = (Foo) getServletContext().getAttribute("foo");

And in JSPs by just EL.
${foo.someProperty}

application_beginRequest
application_endRequest

Implement ServletRequestListener:
@WebListener
public class RequestListener implements ServletRequestListener {

    @Override
    public void requestInitialized(ServletRequestEvent event) {
        // Do your job here on request begin.
    }

    @Override
    public void requestDestroyed(ServletRequestEvent event) {
        // Do your job here on request end.
    }

}

You can store request wide variables as an attribute of the ServletRequest.
event.getServletRequest().setAttribute("foo" new Foo());

It's available in servlets by the passed-in HttpServletRequest argument.
Foo foo = (Foo) request.getAttribute("foo");

And in JSPs by just EL.
${foo.someProperty}

You can even implement the both interfaces in a single class:
@WebListener
public class GlobalListener implements ServletContextListener, ServletRequestListener {
    // ...
}

Or, more common, for sure if you want to be able to modify/control requests more globally, a Filter:
@WebFilter(urlPatterns={"/some/*"})
public class SomeFilter implements Filter {

    @Override
    public void init(FilterConfig config) throws ServletException {
        // Do here your application startup job.

        // If you have any <init-param> in web.xml, then you could get them
        // here by config.getInitParameter("name") and assign it as field.
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        // Do here your request/response preprocessing job.

        // Continue the request/response (if you haven't already forwarded/redirected the request/response beforehand).
        chain.doFilter(request, response);

        // Do here your request/response postprocessing job.
    }

    @Override
    public void destroy() {
        // Do here your application shutdown job.

        // If you have assigned any expensive resources as field of
        // this Filter class, then you could clean/close them here.
    }

}

See also https://stackoverflow.com/tags/servlet-filters/info.
All other listeners of the Servlet API can be found as interfaces in the javax.servlet package. Learn to find your way in the Javadocs.

