Repository:
@Repository
public interface NodeRepo extends Neo4jRepository<BaseNode, Long> {
@Query("MATCH (n) WHERE n.nodeId=$nodeId RETURN n")
BaseNode findByNodeId(String nodeId);
}
Service:
@Component
public class NodeQueryService {
@Autowired
NodeRepo nodeRepo;
@Transactional
public BaseNode fetchPNodeById(String id){
return nodeRepo.findByNodeId(id);
}
}
I am using this service in a class where i used
@Autowired
NodeQueryService nodeQueryService;
But it is giving me this error services.NodeQueryService.fetchPNodeById(String)" because "this.nodeQueryService" is null
What should i do to make it work ?