当前正在使用此包 com.walmart.sams.services.allocation.configuration.service.strategy。但是当我从这个包 com.walmart.sams.services.allocation.configuration.service.repo 自动装配 repo 对象时,它为空。有人可以解释一下吗?它只发生在策略包中。
Repo 类如下所示:
public interface ItemClubConfigRepository extends BaseRepository<ItemClubConfig, Long> {
List<ItemClubConfig> findAllByItemNbrInAndTenantIdAndItemType(Set<Integer> itemNbrs, String tenantId, String itemType);
}
用
@Service
注释图像中显示的服务,如果您使用 Lombok,只需添加 @AllArgsConstructor
那么您应该能够注入您的服务。另外,请确保您注入的服务带有 @Service
或 @Component
或 @Configuration
注释