-
Notifications
You must be signed in to change notification settings - Fork 2
/
DependencyInjection.java
20 lines (17 loc) · 1.01 KB
/
DependencyInjection.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.seanshubin.hello.web;
import javax.servlet.ServletConfig;
class DependencyInjection {
DependencyInjection(ServletConfig servletConfig) {
// ServletConfig is not needed right now.
// I only left this in to demonstrate how this information
// would be passed along from EntryPointServlet if it was needed.
// Taking care of this now also ensures EntryPointServlet never has a reason to change, which means one less thing that can go wrong.
}
// Should these be lazy?
// Easy enough to implement, but not needed yet.
// Don't assume you need complexity until you can measure the cost of living without that complexity.
private final Handler defaultHandler = new NotFoundHandler();
private final DispatchMappings dispatchMappings = new DomainDispatchMappings();
private final Handler dispatcher = new Dispatcher(dispatchMappings, defaultHandler);
final HttpServletRequestHandler httpServletRequestHandler = new TopLevelHttpServletRequestHandler(dispatcher);
}