04-03.eri-test spring @Component @Bean 쓰기

。 I'll say it. Write it.

在 EJB 中 进行 下载 。。 The basis of the revocation was brought in.

Now, let's see. The difference in annotations!

@零件

.'S keulraeyi the generating of course @Scope(“Prototype”). Orientation There is a singleton Further @服务, . @资料库Orientation the eda.

The ear annotation is a declarative annotation, i.e. in the package scan, this annotation says, "You have defined this class, so register it as a bean." It means.

The ear annotation is more than enough to be done.

@豆角,扁豆

This guy goes to @组态the inside of the spring to determine the spring that entered the road. If @零件it is followed, the spring will scan or not @零件. Register the option in this way.

@零件
上市 class 豆豆 {// ...
}

//스프링처리를이해하기쉽게?

@豆角,扁豆
上市 豆豆 myBean() {返回  豆豆();
}

。If it is, please check it and put it in. 。Spring is finished.

Now, why is this guy?

XML格式的XML, 3.0版本的价格.
The version 5.2 5.2 XML settings eunjiwon. If the benefits set to XML?
, Left out and put into a benefit that class setting hypothesis is the end just XML. Really C. Lee Tin cheoda. Agile XML blood gajida after party piece najeongsu jeongsuji.
the beans are to be scanned quickly kaenhal ppareugeyi. XML is a set of XML configuration that does not go because of this.
the scan-based seueul information @豆角,扁豆allows the neunghage Orientation is neunghage the job. instance,

// prop정의빈로。  null받으면开关문에서NullPointerException발생함
@值“ $ {my.prop.动物:}”
私人的  动物;

@豆角,扁豆
上市 动物 动物() {开关animal) {案件 “狗” 返回  ();案件 “猫” 返回  ();案件 “牛” 返回  ();默认   InvalidStateException(“동물정의하고다시!”);}
}

The run cools cools the putty over the Estonian Susukino Suga Is Is Is Is Is Is Is is
also, @零件annotation-based neotsa tie the class to seubin La @豆角,扁豆. Is knowing the calibration.

theorem

Typical empty your registration is easy @零件, Orientation, a registered Yibin If @组态snapper class containing the annotation @豆角,扁豆to the annotation declaration!
In Spring,春季靴@SpringBootApplicationinto the spring Orientation spring @豆角,扁豆let's not forget the Orientation Registration Do not forget yineung high.

from: https://dev.to//composite/spring-component-bean-3hj

Published 0 original articles · liked 0 · visits 124

Guess you like

Origin blog.csdn.net/cunbang3337/article/details/105560521