GH-1138 Fix serverless web container initialization

Resolves #1138
This commit is contained in:
Oleg Zhurakousky
2024-04-25 16:14:35 +02:00
parent d38ab942bd
commit bee5e0b163
6 changed files with 46 additions and 28 deletions

View File

@@ -57,6 +57,14 @@ public class RequestResponseTests {
this.mvc.stop();
}
@Test
public void validateFreemarker() throws Exception {
HttpServletRequest request = new ServerlessHttpServletRequest(null, "GET", "/index");
ServerlessHttpServletResponse response = new ServerlessHttpServletResponse();
mvc.service(request, response);
assertThat(response.getContentAsString()).contains("<h1> hello from freemarker </h1>");
}
@Test
public void validateAccessDeniedWithCustomHandler() throws Exception {
HttpServletRequest request = new ServerlessHttpServletRequest(null, "GET", "/foo/deny");

View File

@@ -53,7 +53,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
@Configuration
@Import({ PetsController.class })
@Import({ PetsController.class, FreemarkerController.class })
@EnableWebSecurity
@EnableAutoConfiguration
public class PetStoreSpringAppConfig {

View File

@@ -0,0 +1,5 @@
<h1> hello from freemarker </h1>
<#list 1..10 as x>
${x}
</#list>