As answered in this question, I supposed that I could inject request/session beans in my test classes when using @WebAppConfuguration (or @WebIntegrationTest for spring boot). I does not work tough.
Here is my test class config:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SocialInfoSrvAppConfig.class)
@WebIntegrationTest
//@IntegrationTest
//@WebAppConfiguration
public class FacebookServiceTest {
...
@Inject
private Facebook facebook;
...
}
Here is my app config:
@SpringBootApplication
// @EnableResourceServer
@EnableJms
@EnableSocial
@EnableWebMvc
public class SocialInfoSrvAppConfig extends SpringCommonApp {
}
I get this error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.facebook': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
as if I could not inject this request scoped bean into my test.
What am I missing?