diff --git a/servlet/java-configuration/hello-mvc-security/gradle/gretty.gradle b/servlet/java-configuration/hello-mvc-security/gradle/gretty.gradle index 342861542..f3afa3d83 100644 --- a/servlet/java-configuration/hello-mvc-security/gradle/gretty.gradle +++ b/servlet/java-configuration/hello-mvc-security/gradle/gretty.gradle @@ -5,6 +5,23 @@ gretty { integrationTestTask = 'integrationTest' } +// In Gretty version 3.x, it was possible to run the appRun task without the /src/main/webapp directory. +// However, strangely, in version 4.x, this directory is required. +task createWebAppDir { + doLast { + def webAppDir = new File(project.projectDir, '/src/main/webapp') + if (!webAppDir.exists()) { + webAppDir.mkdirs() + } + } +} + +project.afterEvaluate { + tasks.named('appRun').configure { + dependsOn createWebAppDir + } +} + Task prepareAppServerForIntegrationTests = project.tasks.create('prepareAppServerForIntegrationTests') { group = 'Verification' description = 'Prepares the app server for integration tests' diff --git a/servlet/java-configuration/hello-mvc-security/src/main/java/example/MvcWebApplicationInitializer.java b/servlet/java-configuration/hello-mvc-security/src/main/java/example/MvcWebApplicationInitializer.java index 567940501..3dffc060d 100644 --- a/servlet/java-configuration/hello-mvc-security/src/main/java/example/MvcWebApplicationInitializer.java +++ b/servlet/java-configuration/hello-mvc-security/src/main/java/example/MvcWebApplicationInitializer.java @@ -16,9 +16,6 @@ package example; -import jakarta.servlet.Filter; - -import org.springframework.web.filter.HiddenHttpMethodFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; public class MvcWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @@ -37,10 +34,4 @@ protected Class[] getServletConfigClasses() { protected String[] getServletMappings() { return new String[] { "/" }; } - - @Override - protected Filter[] getServletFilters() { - return new Filter[] { new HiddenHttpMethodFilter() }; - } - }