I'm trying to use CDI for the deprecated ManagedBean / ManagedProperty annotations and run this exception in a very simple web app:
Error creating bean with name & # 39; navigationController & # 39 ;: Unfulfilled dependency with field & # 39; message & # 39 ;; The nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type & # 39; java.lang.String & # 39; Available: At least one bean is expected to qualify as an autowire candidate. Dependency notes: {@ javax.inject.Inject (), @ org.omnifaces.cdi.Param (validatorAttributes =[]validatorMessage = validators =[], converter =, pathIndex = -1, converterAttributes =[], converterClass = javax.faces.convert.Converter interface, label =, overrideGlobalBeanValidationDisabled = false, required = false, disableBeanValidation = false, name =, validatorClasses =[], converterMessage =, requiredMessage =)}
I'm trying to follow the @Param example in the OmniFaces Showcase at http://showcase.omnifaces.org/cdi/Param.
I put on a page with http: // localhost: 8080 / jsfSpringBootApp / nav.xhtml? Message = My + Message + from + MessageSource. I understand that the NavigationController bean should be created when navigating to nav.xhtml and that the message field is filled with the value taken from the request parameter.
IntellliJ also complains about the @param annotation:
Can not be qualified with @Param
Thanks for any help. I'm sure what to try next.
The entire project can be found at https://david_maffitt@bitbucket.org/david_maffitt/jsfspringbootapp.git.
The content of nav.xhtml is
The content of NavigationController.java is
Package org.nrg.cap.jsfWebApp;
import org.omnifaces.cdi.Param;
import javax.enterprise.context.RequestScoped;
import javax.faces.annotation.ManagedProperty;
Import javax.inject.Inject;
import javax.inject.Named;
import java.io.Serializable;
//@Component
// @ Scope ("request")
@Called
@RequestScoped
public class NavigationController implements Serializable {
@Inject @Param
private string message;
public String showPage () {
return ("fubar" .equals (message))? "Fubar": "Snafu";
}
public void setAction {string message) {
this.message = message;
}
public String getAction () {
feedback
}
}
The pom.xml is
4.0.0
org.nrg.cap
jsfSpringBootApp
1,0-SNAPSHOT
war
JSF Spring Boot WebApp
UTF-8
1.8
4.0.0
org.springframework.boot
Spring Boat Starter parent
2.1.1. RELEASE
org.joingesichter
Joinfaces dependencies
$ {joinfaces.version}
pom
introduce
org.joingesichter
Prime Faces Spring Boot Starter
org.joingesichter
omnifaces3-spring-boot-starter
javax.enterprise
cdi-api
2.0.SP1
I found out that I had to add the dependency for cdi-api, since I'm providing tomcat 9.0.13, which did not bake cdi.
The pom is derived from the joinfaces project.