Is bean itself equivalent to an agent in spring?

for example, if you get a Bean, at a certain location, you only know the location of the corresponding instance of the Bean. When you call it, you just pass the parameter and get the result of the operation. There is such a scene:

class A{
    void method()...
}

class B{
    @Bean
    A a;
}

class C{
    A a = ctx.getBean(A);
    a.method();
}

B and C respectively belong to two interactive programs . An instance is generated in B. C obtains the bean, of this instance through a certain method. When C calls a method in this instance, does it just pass the parameter information to B, and the actual execution of the method is in program B?

Jan.12,2022

you can think of spring as a giant factory,bean, just an instance, the same as you get it in factory mode

Menu