circular dependency is a relation between two or more modules which either directly or indirectly depend on each other to function properly.
Questions tagged [circular-dependency]
1693 questions
11
votes
4 answers
Good practices on finding circular dependencies between spring beans
I have this exception:
SEVERE: Context initialization failedorg.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'myService': Bean with name 'myService' has been injected into other beans [otherService]…

Simeon
- 7,582
- 15
- 64
- 101
11
votes
1 answer
Does F# support interdependent classes in separate files?
I'm working on IronJS, and one of our source files is getting very long.
Right now, I'm trying to get .NET interop working. I'm adding the TryBinaryOperation method to the Undefined so that C# can use the JavaScript semantics of the Undefined…

John Gietzen
- 48,783
- 32
- 145
- 190
11
votes
6 answers
Angular circular dependency between 2 components
I'm developing an Angular 7 application which allows management of entities, for example Cars and Students.
The application components can be described by the following tree:
Cars
Cars/CreateCar (dialog)
Students
Students/CreateStudent…

Tomás Law
- 141
- 1
- 1
- 6
11
votes
3 answers
GraphQL circular dependency
I am fairly new to javascript and am currently learning to implement a graphQL API with a MongoDB backend using Node.js. I am running into a problem with a circular dependency between two types.
Basically, I have a classic blog post/blog author…

Bastian
- 203
- 2
- 7
11
votes
2 answers
ES6 circular dependency
This is an issue I run into fairly frequently, and I was hoping to discover the correct way to handle it.
So I have a setup like this:
parent.js:
export default {
x: 1
}
a.js:
import parent from 'parent.js'
export default parent.extend(a, {…

Hud
- 113
- 1
- 6
11
votes
1 answer
Python/Django: Why does importing a module right before using it prevent a circular import?
I've run into this problem a few times in different situations but my setup is the following:
I have two Django models files. One that contains User models and CouponCodes that a user can use to sign up for a Course. Those are both in the…

Spartacus
- 305
- 2
- 11
11
votes
4 answers
Python: circular imports needed for type checking
First of all: I do know that there are already many questions and answers to the topic of the circular imports.
The answer is more or less: "Design your Module/Class structure properly and you will not need circular imports". That is true. I tried…

Philip Daubmeier
- 14,584
- 5
- 41
- 77
11
votes
4 answers
Organizing interfaces
I am just reading Agile Principles, Patterns and Practices in C# by R. Martin and M. Martin and they suggest in their book, to keep all your interfaces in a separate project, eg. Interfaces.
As an example, if I have a Gui project, that contains all…

Thorsten Lorenz
- 11,781
- 8
- 52
- 62
11
votes
5 answers
MVC - circular dependency
I need the view to hold a reference to the contoller because it needs to register the controller as an event listener.
I need the contoller to hold a reference to the view, because upon button click, I need to be able to get the selected files in a…

Shmoopy
- 5,334
- 4
- 36
- 72
10
votes
1 answer
How to break circular dependencies between repositories
To begin with, no I'm not using an ORM, nor am I allowed to. I have to hand-roll my repositories using ADO.NET.
I have two objects:
public class Firm
{
public Guid Id { get; set; }
public string Name { get; set; }
public virtual…

Michael McCarthy
- 1,502
- 3
- 18
- 45
10
votes
1 answer
Best Way to Resolve Circular Module Loading
I'm trying to have two different objects that refer to each other and also use type checking on the attributes. When I do this I get Circular module loading detected trying to precompile. Googling gets me…

JustThisGuy
- 1,109
- 5
- 10
10
votes
3 answers
Nest can't resolve dependencies of the UserService (?, +). Please make sure that the argument at index [0] is available in the current context
having some problems, di/circular-references I'm sure I'm doing wrong, I just can't see it.
Any help would be much appreciated
user.module.ts
@Module({
imports: [
TypeOrmModule.forFeature([User]),
forwardRef(() => AuthModule)
…

Diego Antunes
- 848
- 1
- 7
- 8
10
votes
1 answer
Forward declarations in C++ modules (MSVC)
I have been experimenting with modules implementation as provided by the MSVC lately and I've run into an interesting scenario. I have two classes that have a mutual dependency in their interfaces, which means that I'll have to use forward…

Qub1
- 1,154
- 2
- 14
- 31
10
votes
3 answers
Is this a Circular dependency?
is this code a example of circular dependency?
package expr;
import sheet.Sheet
public class AdressExpr implements Expr
{
private Address address;
private Sheet sheet;
public double value(Sheet sheet)
{
return…

qwert
- 101
- 3
10
votes
1 answer
Intermittent "Circular dependency detected while autoloading constant" errors in production
I have a Rails project that, every now and then, throws this exception in production, in a non-reproducible manner. Everything works well in development and test, and apparently in production too, but ExceptionNotifier every few weeks emails me with…

Daniel Magliola
- 30,898
- 61
- 164
- 243