From 3ad79e919bab6eaa1986bd8504a8c5be3ac41dc3 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Mon, 16 Oct 2023 12:58:07 +0200 Subject: [PATCH] Modify tests so they pass in AOT mode ... when run via AotIntegrationTests.endToEndTestsForEntireSpringTestModule(). --- .../test/context/hierarchies/web/EarTests.java | 2 +- .../test/context/hierarchies/web/RootWacEarTests.java | 4 ++-- .../test/web/servlet/samples/spr/EncodedUriTests.java | 6 +++--- .../test/web/servlet/samples/spr/HttpOptionsTests.java | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/EarTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/EarTests.java index 00aac815719d..9519b3fb7615 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/EarTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/EarTests.java @@ -34,7 +34,7 @@ @SpringJUnitConfig class EarTests { - @Configuration + @Configuration(proxyBeanMethods = false) static class EarConfig { @Bean diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/RootWacEarTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/RootWacEarTests.java index d53f9b10afde..b0805a32657b 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/RootWacEarTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/RootWacEarTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ @ContextHierarchy(@ContextConfiguration) class RootWacEarTests extends EarTests { - @Configuration + @Configuration(proxyBeanMethods = false) static class RootWacConfig { @Bean diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/EncodedUriTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/EncodedUriTests.java index 39560381e5e7..a58a8e571623 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/EncodedUriTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/EncodedUriTests.java @@ -72,7 +72,7 @@ void test() throws Exception { } - @Configuration + @Configuration(proxyBeanMethods = false) @EnableWebMvc static class WebConfig implements WebMvcConfigurer { @@ -93,7 +93,7 @@ public void configureViewResolvers(ViewResolverRegistry registry) { } @Controller - private static class MyController { + static class MyController { @RequestMapping(value = "/circuit/{id}", method = RequestMethod.GET) String getCircuit(@PathVariable String id, Model model) { @@ -103,7 +103,7 @@ String getCircuit(@PathVariable String id, Model model) { } @Component - private static class HandlerMappingConfigurer implements BeanPostProcessor, PriorityOrdered { + static class HandlerMappingConfigurer implements BeanPostProcessor, PriorityOrdered { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/HttpOptionsTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/HttpOptionsTests.java index 175d11e1f493..8f5b6057065d 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/HttpOptionsTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/HttpOptionsTests.java @@ -65,7 +65,7 @@ void test() throws Exception { } - @Configuration + @Configuration(proxyBeanMethods = false) @EnableWebMvc static class WebConfig implements WebMvcConfigurer { @@ -76,7 +76,7 @@ MyController myController() { } @Controller - private static class MyController { + static class MyController { private final AtomicInteger counter = new AtomicInteger();