The effects of incorrect spring initialization

I am working with a incorrectly created spring application. Instead of using IOCs, objects that require links pull their links out of context:

    BeanFactory b = SingletonBeanFactoryLocator.getInstance().
               useBeanFactory("factory").getFactory();
    Bean foo = (FOO)beanFactory.getBean("foo");

Putting aside design not related to the IOC, what are the other negative consequences of this? For example, does this have any specific performance implications? Is there a way that can lead to the creation of additional contexts or object references? Anything else unpleasant that this might cause?

+3
source share
3 answers

" fortran ". spring , , spring . spring . , . ( , )

- . , , , - .

, , spring, , , , "" spring; xml. xml.

+1

, , , , bean , , , .

, bean , . , , beans, beans , , beans beans, - DataSource bean, JDBC , , .

+1

, " " getBean(); , . , : - , , , . GUI-, .

Any of the other functions that Spring provides (AOP, scoped beans, etc.) will behave the same, regardless of whether the object was entered or retrieved from the container.

+1
source

Source: https://habr.com/ru/post/1702143/


All Articles