The following diagram provides an Overview of the GeoServer architecture. The GeoServer application is comprised of a series of modules. GeoServer modules can be combined with our maven 2 build sytem to form a deployable war.

At runtime a module can make use of Spring to obtain classes providing services from other modules. This ability to "plug-in" additional functionality forms the basis for GeoServers extension mechanism. This mechanism is used to provide additional OGC web services (by the WFS and WMS modules) and to implement support for different WMS image encodings.
The core geoserver modules server as a useful example of how new services can be added. You can review the web module for an example of packaging modules into a deployable war.