BAEL-2399: Guice vs Spring - Dependency Injection
This commit is contained in:
parent
bd63df8caf
commit
3ac96662fc
|
@ -0,0 +1,8 @@
|
|||
package com.baeldung.examples.common;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PersonDaoImpl implements PersonDao {
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.baeldung.examples.guice;
|
||||
|
||||
import com.baeldung.examples.common.PersonDao;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
public class GuicePersonService {
|
||||
|
||||
@Inject
|
||||
private PersonDao personDao;
|
||||
|
||||
public PersonDao getPersonDao() {
|
||||
return personDao;
|
||||
}
|
||||
|
||||
public void setPersonDao(PersonDao personDao) {
|
||||
this.personDao = personDao;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue