8--deep use of spring--2...5 Spring 3.0 new annotations

Source: Internet
Author: User

8.2.5 Spring 3.0 New annotations

@DependsOn @Lazy

        

@DependsOn: Used to force the initialization of other beans. Modifies the Bean class or method, you can specify a string array as the parameter, and each array element corresponds to a bean that is forced to initialize.

 Package Edu.pri.lime._8_2_5.bean; Import org.springframework.context.annotation.DependsOn; Import org.springframework.stereotype.Component; @DependsOn ({"steelaxe", "Lime"})    // specifies that steelaxe, lime two beans will be forced to initialize before the Chinese bean is initialized @Component  Public class Chinese {}

@Lazy: Used to specify whether the bean cancels pre-initialization.

 Package Edu.pri.lime._8_2_5.bean; Import Org.springframework.context.annotation.Lazy; Import org.springframework.stereotype.Component; @Lazy (true)    // The decorated spring Bean class is used to specify the pre-initialization behavior of this Ben, specifying a Boolean value property that determines whether to pre-initialize the bean @Component  Public class French {}

La La la

8--deep use of spring--2...5 Spring 3.0 new annotations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.