I'm using Hibernate, Spring & JSF for an application. I'm actually evolving the application with a Restfull WebService with Jersey(JAX-RS). For that need i annotated my class with @Component. Inside this class, i need to call a service to grap some stuffs from the database.
@Component
@Path("/Graphic")
public class GraphicService {
//@Autowired //@Inject
//ParticipantBo participantBo;
or
//@ManagedProperty("#{participantBo}")
//private ParticipantBo participantBo;
I meet some annotations in tutorials that i don't know/understand well the meaning. So i'd like to make a check-up to see if my configuration for the whole application is ok or if i could clean up some stuffs.
Most of the time, i'm using @ManagedProperty Annotation to include a dependency (a ServiceBO which one call then a Dao) inside my class annotated with @ManagedBean.
@ManagedBean(name="participantController")
@ViewScoped
public class AddParticipantBean implements Serializable{
private static final long serialVersionUID = -6952203235934881190L;
@ManagedProperty(value="#{participantBo}")
ParticipantBo participantBo;
}
I have an applicationContext.xml file where i declare all my classes this way :
<!-- Participant Data Access Object -->
<bean id="participantDao" class="X.X.X.dao.participant.ParticipantDaoImpl" >
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- Participant Business Object -->
<bean id="participantBo" class="X.X.X.bo.participant.ParticipantBoImpl" >
<property name="participantDao" ref="participantDao" />
</bean>
Is my configuration well done ? Could i configure the application differently ? , maybe without xml declaration ? using @Inject or @AutoWired maybe ? But what are the use cases for them ?