What is the use of @Order annotation in Spring?

后端 未结 3 435
深忆病人
深忆病人 2020-12-08 02:09

I have come across a glance of code which uses @Order annotation. I want to know what is the use of this annotation with respect to Spring Security or Spring MV

3条回答
  •  余生分开走
    2020-12-08 03:00

    @Order Annotations (as well as the Ordered interface) implies a specific order, in which the beans will be loaded or prioritized by Spring.

    Lower numbers indicate a higher priority. The feature may be used to add beans in a specific order into a collection (ie via @Autowired), among other things.

    In your specific example the annotation does not change anything in the class itself. Whereever this specific class is used, it is used with the highest priority (since it is set as '1'), probably since additional, but depending information is being added in other classes, ordered at a lower precedence.

提交回复
热议问题