Home > Back-end >  How to create many cases of bean spring annotations way.
How to create many cases of bean spring annotations way.

Time:10-15

Using annotations of the spring framework, now need to get more cases of bean, each invocation are new, and does not limit the scope, not tried the scope notes, may be, I don't have to do some code to see please

CodePudding user response:

Configure the scope=prototype

CodePudding user response:

reference 1st floor zhs471420954 response:
configuration scope=prototype

Is to use annotations in the way, to create the bean using the @ Scope (" prototype "), but when you use the @ resource injection, seemingly or singleton, could you write down for bean method

CodePudding user response:

How do you determine is singleton

CodePudding user response:

reference zhs471420954 reply: 3/f
how do you determine is singleton

Can't get two different objects, the address is the same, and in a method to the object's member variable assignment, out of the way after all values have been emptied

CodePudding user response:

The caller and the called party plus @ the Scope is to take effect

CodePudding user response:

//tell Java to create more cases of bean
System. Out.println (" create more cases of beans for me!!!!!!!!!!!!!!!!!!!!!!!!
")

CodePudding user response:

Directly by spring, more cases of why the new don't you go

CodePudding user response:

Without annotation, the bean wrote directly to the configuration file, need more case attributes should be ok

CodePudding user response:

https://baijiahao.baidu.com/s? Id=1641275124389585515 & amp; WFR=spider& For=PC
  • Related