Questions tagged [circular-dependency]

circular dependency is a relation between two or more modules which either directly or indirectly depend on each other to function properly.

1693 questions
15
votes
1 answer

Nest.js: Circular dependencies in dynamic modules

What is the correct way to import dynamic modules when there's a circular dependency between them? I simply changed forwardRef(() => MyModule) to forwardRef(() => MyModule.forRoot()), and I'm getting Nest can't resolve dependencies error.
dols3m
  • 1,676
  • 2
  • 16
  • 25
15
votes
3 answers

Circular dependency injection angular 2

I've been struggling around injecting services into each other. The following blog Circular Dependency in constructors and Dependency Injection is kind of confusing where it says One of the two objects is hiding another object C I get the…
Basheer Kharoti
  • 4,202
  • 5
  • 24
  • 50
15
votes
3 answers

Circular Dependency Solution

Our current project has ran into a circular dependency issue. Our business logic assembly is using classes and static methods from our SharedLibrary assembly. The SharedLibrary contains a whole bunch of helper functions, such as a SQL Reader class,…
gfoley
  • 175
  • 1
  • 2
  • 7
15
votes
3 answers

AngularJS circular dependency

I'm making a logger service, to extend angular's $log service, by saving the errors (or debug if enabled) into an indexedDB database. Here's the code: angular.module('appLogger', ['appDatabase']) .service('LogServices', function($log, Database) { …
ImSoNuts
  • 167
  • 1
  • 1
  • 5
15
votes
1 answer

Xcode ios Unknown type name?

I have a question about the following error "Unknown type name VistaDereIzq" I have a view called VistaDereIzq. And I do the following to add that view in this view. #import #import #import…
Fabio
  • 1,913
  • 5
  • 29
  • 53
15
votes
6 answers

Circular C++ Header Includes

In a project I have 2 classes: // mainw.h #include "IFr.h" ... class mainw { public: static IFr ifr; static CSize=100; ... }; // IFr.h #include "mainw.h" ... class IFr { public float[mainw::CSize]; }; But I cannot compile this code, getting an…
paul simmons
  • 413
  • 1
  • 4
  • 11
14
votes
2 answers

ruby: how to require correctly (to avoid circular dependencies)

today i was facing a strange problem: got a 'missing method' error on a module, but the method was there and the file where the module was defined was required. After some searching i found a circular dependency, where 2 files required each other,…
14
votes
3 answers

forward declaration with vector of class type - pointer to incomplete class type not allowed

I have two classes, foo and bar. foo.h #includes bar.h and contains a std::vector of pointers to bar objects. At some point during runtime, bar has to access this vector of pointers to other bar objects. Therefore, foo contains a method named…
Aerius
  • 588
  • 5
  • 24
14
votes
2 answers

ClassCircularityError thrown by ClassLoader.defineClass

I'm loading classes using a custom class loader. For the most part, everything works, but sometimes when I load particularly complex projects/libraries, I get a strange bug: Exception in thread "main" java.lang.ClassCircularityError: …
Jim
  • 2,111
  • 4
  • 25
  • 34
14
votes
4 answers

Fixing import cycle in Go

So I have this import cycle which I'm trying to solve. I have this following pattern: view/ - view.go action/ - action.go - register.go And the general idea is that actions are performed on a view, and are executed by the view: // view.go type View…
flooblebit
  • 477
  • 1
  • 3
  • 9
14
votes
4 answers

Circular imports hell

Python is extremely elegant language. Well, except... except imports. I still can't get it work the way it seems natural to me. I have a class MyObjectA which is in file mypackage/myobjecta.py. This object uses some utility functions which are in…
14
votes
3 answers

How do I detect circular logic or recursion in a multi-levels references and dependencies

I have a graph of multi-level dependecies like this, and I need to detect any circular reference in this graph. A = B B = C C = [D, B] D = [C, A] Somebody have a problem like this? Any solution??? Thanks and sorry by english. ========= updated…
LuigleDR
  • 309
  • 1
  • 2
  • 13
14
votes
4 answers

Circular References in my C# projects

I have the following situation: A project MyCompany.MyProject.Domain which contains my domain model, and partial classes (such as Contact). I want to 'extend' (by partial class, not extension method) my Contact class with a property Slug which will…
Alex
  • 75,813
  • 86
  • 255
  • 348
14
votes
2 answers

C++, two classes with mutual needs

I have converted a scientific simulation platform from Java into C++. I have tried to keep the design as much as possible the same as previous implementation. In java because of the late binding, circular dependencies are resolved at the run time.…
wmac
  • 1,023
  • 1
  • 16
  • 34
13
votes
4 answers

Circular reference in same assembly a bad thing?

Assume I have the following classes in the same assembly public class ParentClass : IDisposable { public ChildClass Child { get { return _child; } } } public class ChildClass { public ParentClass Parent { get { return…
user20358
  • 14,182
  • 36
  • 114
  • 186