Question

I'm trying to make webapp which should use thymeleaf with spring controllers. But I'd like to have some CDI ConversationScoped beans injected into my Spring controller. For now I managed to configure CDI with my Spring application I when I tried to incject CDI bean into my controller it seems to work fine, but when I tried to inject Conversation bean it fails with error:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [javax.enterprise.context.Conversation] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.inject.Inject()}
Was it helpful?

Solution

In CDI 1.0 the conversation scope is tied to JSF. If you're not using JSF you won't be able to access the conversation scope. You could create another scope which mimics the conversation scope though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top