Skip to content

Commit 0279250

Browse files
committed
Fix on request dispatcher to maintain compatibility with spring 4.3.x and test fixes for older spring
1 parent 3d05700 commit 0279250

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ public class AwsProxyRequestDispatcher implements RequestDispatcher {
3939

4040

4141
public AwsProxyRequestDispatcher(final String target, final boolean namedDispatcher, final AwsLambdaServletContainerHandler handler) {
42-
if (!namedDispatcher && !target.startsWith("/")) {
43-
throw new UnsupportedOperationException("Only dispatchers with absolute paths are supported");
44-
}
45-
4642
isNamedDispatcher = namedDispatcher;
4743
dispatchTo = target;
4844
lambdaContainerHandler = handler;

aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/springbootslowapp/TestApplication.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
import org.springframework.boot.autoconfigure.SpringBootApplication;
66
import org.springframework.boot.web.support.SpringBootServletInitializer;
77
import org.springframework.context.annotation.ComponentScan;
8-
import org.springframework.context.annotation.PropertySource;
98
import org.springframework.stereotype.Component;
109

11-
12-
@SpringBootApplication
13-
@ComponentScan(basePackages = "com.amazonaws.serverless.proxy.spring.springbootslowapp")
14-
@PropertySource("classpath:boot-application.properties")
10+
// Need to explicitly exclude security because of some bizarre witchcraft inside SpringBoot that
11+
// enables it even when I don't ask for it - this is only true when I test against spring-webmvc 4.3.x
12+
@SpringBootApplication(exclude = {
13+
org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class
14+
})
15+
@ComponentScan(basePackages="com.amazonaws.serverless.proxy.spring.springbootslowapp")
1516
public class TestApplication extends SpringBootServletInitializer {
1617
@Component
1718
public static class SlowDownInit implements InitializingBean {

aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/springslowapp/MessageController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import org.springframework.web.bind.annotation.RequestMapping;
44
import org.springframework.web.bind.annotation.RequestMethod;
55
import org.springframework.web.bind.annotation.RestController;
6+
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
67

78
@RestController
9+
@EnableWebMvc
810
public class MessageController {
911
public static final String HELLO_MESSAGE = "Hello";
1012

aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/springslowapp/SlowAppConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
import org.springframework.context.annotation.Import;
66
import org.springframework.stereotype.Component;
77

8+
89
@Configuration
910
@Import({MessageController.class})
1011
public class SlowAppConfig {
12+
1113
@Component
1214
public static class SlowDownInit implements InitializingBean {
1315
public static final int INIT_SLEEP_TIME_MS = 13_000;

0 commit comments

Comments
 (0)