문제

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;
도움이 되었습니까?

해결책

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

@Component("user")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top