From 86af93a5044f9a9845a50b417ac16b7305bb566b Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Mon, 26 Oct 2020 07:40:33 +0000 Subject: [PATCH] Correct sample in webmvc.adoc Closes gh-25965 --- src/docs/asciidoc/web/webmvc.adoc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/docs/asciidoc/web/webmvc.adoc b/src/docs/asciidoc/web/webmvc.adoc index 34d84028206..de6e917f94a 100644 --- a/src/docs/asciidoc/web/webmvc.adoc +++ b/src/docs/asciidoc/web/webmvc.adoc @@ -46,16 +46,15 @@ the `DispatcherServlet`, which is auto-detected by the Servlet container public class MyWebApplicationInitializer implements WebApplicationInitializer { @Override - public void onStartup(ServletContext servletCxt) { + public void onStartup(ServletContext servletContext) { // Load Spring web application configuration - AnnotationConfigWebApplicationContext ac = new AnnotationConfigWebApplicationContext(); - ac.register(AppConfig.class); - ac.refresh(); + AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); + context.register(AppConfig.class); // Create and register the DispatcherServlet - DispatcherServlet servlet = new DispatcherServlet(ac); - ServletRegistration.Dynamic registration = servletCxt.addServlet("app", servlet); + DispatcherServlet servlet = new DispatcherServlet(context); + ServletRegistration.Dynamic registration = servletContext.addServlet("app", servlet); registration.setLoadOnStartup(1); registration.addMapping("/app/*"); } @@ -66,16 +65,15 @@ the `DispatcherServlet`, which is auto-detected by the Servlet container ---- class MyWebApplicationInitializer : WebApplicationInitializer { - override fun onStartup(servletCxt: ServletContext) { + override fun onStartup(servletContext: ServletContext) { // Load Spring web application configuration - val ac = AnnotationConfigWebApplicationContext() - ac.register(AppConfig::class.java) - ac.refresh() + val context = AnnotationConfigWebApplicationContext() + context.register(AppConfig::class.java) // Create and register the DispatcherServlet - val servlet = DispatcherServlet(ac) - val registration = servletCxt.addServlet("app", servlet) + val servlet = DispatcherServlet(context) + val registration = servletContext.addServlet("app", servlet) registration.setLoadOnStartup(1) registration.addMapping("/app/*") }