Question

In the following snippet, when I give the @ManagedBean a specific name, userService and authenticationService are not injected. But if I use only @ManagedBean without name, the injection works fine. Any idea?

@Component
@ManagedBean(name="user") // the injection doesn't work
//@ManagedBean // the injection works
@SessionScoped
public class UserManagedBean implements Serializable {

    // Spring User Service is injected...
    @Autowired
    UserService userService;
    @Autowired
    private AuthenticationService authenticationService;
Était-ce utile?

La solution

when you use @ManagedBean(name="user") try specify the same name for component as well and see if that works.

@Component("user")
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top