There are several repositories for different entities:
public interface ItemRepository extends CrudRepository<Item, Integer> { } public interface UserRepository extends CrudRepository<User, Integer> { } public interface RoleRepository extends CrudRepository<Role, Integer> { } And there are places in the service level where you need to use all three at once (and if there are 10 of them ...). And it turns out that you need to create instances of each of these fields. Something like this:
@Service public class ItemServiceImpl implements ItemService { @Autowired private final ItemRepository itemRepo; @Autowired private final UserRepository userRepo; @Autowired private final RoleRepository roleRepo; ...и тут их использовать... } It seems to me or a crutch? What do they do in such cases? Can they somehow combine? Maybe there is some kind of pattern or a whole approach to solving such situations. Because the case seems to me typical. Tell me how it is solved. Thank.