|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
|
* Copyright 2002-2018 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. |
|
|
|
@ -36,13 +36,14 @@ import org.springframework.context.annotation.ScopedProxyMode;
@@ -36,13 +36,14 @@ import org.springframework.context.annotation.ScopedProxyMode;
|
|
|
|
|
import org.springframework.mock.web.MockHttpServletRequest; |
|
|
|
|
import org.springframework.test.annotation.DirtiesContext; |
|
|
|
|
import org.springframework.test.context.ContextConfiguration; |
|
|
|
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
|
|
|
|
import org.springframework.test.context.junit4.SpringRunner; |
|
|
|
|
import org.springframework.test.context.web.WebAppConfiguration; |
|
|
|
|
import org.springframework.test.web.servlet.MockMvc; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
import org.springframework.web.context.WebApplicationContext; |
|
|
|
|
import org.springframework.web.context.annotation.RequestScope; |
|
|
|
|
import org.springframework.web.context.annotation.SessionScope; |
|
|
|
|
import org.springframework.web.context.request.RequestAttributes; |
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder; |
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
|
@ -71,7 +72,7 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppC
@@ -71,7 +72,7 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppC
|
|
|
|
|
* @author Sam Brannen |
|
|
|
|
* @see CustomRequestAttributesRequestContextHolderTests |
|
|
|
|
*/ |
|
|
|
|
@RunWith(SpringJUnit4ClassRunner.class) |
|
|
|
|
@RunWith(SpringRunner.class) |
|
|
|
|
@WebAppConfiguration |
|
|
|
|
@ContextConfiguration |
|
|
|
|
@DirtiesContext |
|
|
|
@ -163,7 +164,6 @@ public class RequestContextHolderTests {
@@ -163,7 +164,6 @@ public class RequestContextHolderTests {
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
@RequestScope |
|
|
|
|
@Scope(scopeName = "request", proxyMode = ScopedProxyMode.TARGET_CLASS) |
|
|
|
|
public RequestScopedService requestScopedService() { |
|
|
|
|
return new RequestScopedService(); |
|
|
|
|
} |
|
|
|
@ -174,7 +174,7 @@ public class RequestContextHolderTests {
@@ -174,7 +174,7 @@ public class RequestContextHolderTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
@Scope(scopeName = "session", proxyMode = ScopedProxyMode.TARGET_CLASS) |
|
|
|
|
@SessionScope |
|
|
|
|
public SessionScopedService sessionScopedService() { |
|
|
|
|
return new SessionScopedService(); |
|
|
|
|
} |
|
|
|
|