Skip to content

Commit 7b8a3a5

Browse files
committed
Edit UserService.java
1 parent a3c9591 commit 7b8a3a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Spring_part_3/src/main/java/spring/oldboy/service/UserService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ public class UserService {
2323
*/
2424
private final CrudRepository<Integer, Company> companyRepository;
2525

26-
/* И внедряем его через конструктор */
26+
/*
27+
И внедряем его через конструктор. Поскольку у нас может быть несколько bean-ов
28+
реализующих CrudRepository, то конкретный bean, Spring будет искать на основании
29+
названия параметра переданного в конструктор - companyRepository.
30+
*/
2731
public UserService(UserRepository userRepository,
2832
CrudRepository<Integer, Company> companyRepository) {
2933
this.userRepository = userRepository;

0 commit comments

Comments
 (0)