I am using Spring and JSF 2.0. This is how my class look like @ManagedBean(name = "userLogin", eager = true) @SessionScoped public class UserLogin
in this class I am using the following property
@Autowired
@ManagedProperty(value = "#{userService}")
private UserService userService;
And this is how my userService looks like
@Service ("userService")
In a framework like struts , I can use the userService without setters and getters , as its been named as a service. Please tell how to use this without setters and getters , as I feel like its kind of a overhead.
Basically I just want to get rid of getters and setters for the userService as its a Spring bean.
Regards Rashen
@ManagedProperty(value = "#{userService}")
probably does nothing here, since UserService
is not a JSF managed bean (judging from the code in your comment). You are combining two dependency injection strategies, where you only need one (setter is required for @ManagedProperty
).
If you remove @ManagedProperty
and leave only @Autowired
, I think it should work.