Context and tomcat



I’m a little confused about the relationship between a spring ApplicationContext like AnnotationConfigApplicationContext ( and tomcat.

I know I have to inject (or, set, rather) a context on my tomcat instance, but spring boot usually does this for me under the hood.

What is a context (is this a fancy name for bean factory or something?) and how does spring boot tell tomcat what the context is?



That is because there really is no ‘relationship’ between these two. To make things very simple, yes, an applicationcontext is just that: a fancy name for a beanfactory.

Tomcat itself doesn’t care about that beanfactory. Or any other objects for that matter. Tomcat only cares about servlets and filters and that’s what your other question is about, which i’ll answer in the respective thread.