In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "Spring @ Lazy annotation parsing". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
@ Lazy is used to specify whether the Bean is unpreinitialized. Mainly used to modify the Spring Bean class to specify the preinitialization behavior of the Bean
When using this Annotation, you can specify a Boolean value property that determines whether to preinitialize the Bean
Lazy represents delayed loading, lazy=false, represents no delay, if there is still a reference to object B in object A, the object reference of b will be configured in A's xml mapping file, many to one or one to many, no delay means that when querying out object A, the B object will also be queried into the reference of An object, and the B object in An object is valuable.
Lazy=true stands for delay. When querying An object, B object will not be queried. It will only be queried when B object in An object is used. By default, it seems to be false. You can see the change of sql statement in the background. It is generally used when you need to optimize efficiency.
@ Lazy (true) @ Componentpublic class Chinese implements Person {/ / codes here}
@ DependsOn is used to force initialization of other Bean. You can modify Bean classes or methods. When using this Annotation, you can specify an array of strings as parameters, and each array element corresponds to a forced initialization Bean.
DependsOn ({"steelAxe", "abc"}) @ Componentpublic class Chinese implements Person {/ / codes here}
So much for the introduction of "Spring @ Lazy Annotation using parsing". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.