Merge pull request #13408 from cesarevalenti90/master
BAEL-6125 - Migrate Application from Spring Boot 2 to Spring Boot 3
This commit is contained in:
		
						commit
						fe1b548e38
					
				| @ -0,0 +1,21 @@ | ||||
| package com.baeldung.sample.boundary; | ||||
| 
 | ||||
| import org.apache.catalina.connector.Connector; | ||||
| import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer; | ||||
| import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; | ||||
| import org.springframework.boot.web.server.WebServerFactoryCustomizer; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| 
 | ||||
| @Configuration | ||||
| public class ServerConfiguration implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> { | ||||
| 
 | ||||
|     @Override | ||||
|     public void customize(TomcatServletWebServerFactory factory) { | ||||
|         factory.addConnectorCustomizers(new TomcatConnectorCustomizer() { | ||||
|             @Override | ||||
|             public void customize(Connector connector) { | ||||
|                 connector.setProperty("maxHttpResponseHeaderSize", "100000"); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
| } | ||||
| @ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| import java.net.URI; | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
| import java.util.stream.Collectors; | ||||
| 
 | ||||
| import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; | ||||
| @ -35,6 +36,13 @@ public class TodosController { | ||||
|     // Mapping zwischen den Schichten | ||||
|     private final TodoDtoMapper mapper; | ||||
| 
 | ||||
| 
 | ||||
|     @GetMapping(value = {"/name"},produces = DEFAULT_MEDIA_TYPE) | ||||
|     public List<String> findAllName(){ | ||||
|         return List.of("Hello", "World"); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @GetMapping(produces = DEFAULT_MEDIA_TYPE) | ||||
|     public Collection<TodoResponseDto> findAll() { | ||||
|         return service.findAll().stream() | ||||
| @ -80,4 +88,4 @@ public class TodosController { | ||||
|         service.delete(id); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| } | ||||
| @ -0,0 +1,13 @@ | ||||
| package com.baeldung.sample.boundary; | ||||
| 
 | ||||
| import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; | ||||
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||||
| 
 | ||||
| public class WebConfiguration implements WebMvcConfigurer { | ||||
| 
 | ||||
|     @Override | ||||
|     public void configurePathMatch(PathMatchConfigurer configurer) { | ||||
|         configurer.setUseTrailingSlashMatch(true); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -215,4 +215,18 @@ class TodosControllerApiIntegrationTest { | ||||
|           .andExpect(status().isNotFound()); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     void whenThereIsNoSlashMatching_ThenHttpStatusIs404() throws Exception { | ||||
|         mvc | ||||
|           .perform(get(BASEURL + "/name/").contentType(DEFAULT_MEDIA_TYPE)) | ||||
|           .andExpect(status().isNotFound()); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     void whenThereIsNoSlashMatching_ThenHttpStatusIs200() throws Exception { | ||||
|         mvc | ||||
|           .perform(get(BASEURL + "/name").contentType(DEFAULT_MEDIA_TYPE)) | ||||
|           .andExpect(status().isOk()); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user