What are Spring s IOCs and AOPs?

Updated on technology 2024-02-25
10 answers
  1. Anonymous users2024-02-06

    The guy upstairs said the concept. I'll say more.

    IOC is a container, and everything that is created is created in a container. You can think of this thing as something like a factory model.

    AOP is a facet. You can understand that this thing is facing a method, for example, a method is a method for reading the database, then at various moments of method execution, before after, afterrunning, around these moments to do something, for example, before reading I print a line of logs I am ready to read, at the end of printing a line I finished reading, when I print an error to print a log. Of course, you can also do other things, such as calling other methods.

    That's pretty much how you can understand it.

  2. Anonymous users2024-02-05

    IOC is reverse control.

    AOP is for section-oriented programming.

  3. Anonymous users2024-02-04

    IOC: Inversion of Control is also called dependency injection. The factory model was utilized.

    To hand over the object to the container management, you only need to configure the corresponding bean in the spring configuration file, and set the relevant properties, so that the spring container can generate the instance objects of the class and manage the objects. When the Spring container starts, Spring will initialize all the beans you configured in the configuration file, and then when you need to call them, assign the initialized beans to the classes you need to call these beans (assuming the class name is A), and the assigned method is to call the setter method of A to inject them, without you needing to update these beans in A.

    Note: During the interview, if you have the conditions, draw a picture, so that you can make it more obvious that you understand.

    AOP: Programming for facets. (aspect-oriented programming)

    AOP can be said to be a supplement and improvement to OOP. OOP introduces concepts such as encapsulation, inheritance, and polymorphism to establish a hierarchy of objects that simulates a collection of public behavior. When we need to introduce public behavior for dispersed objects, OOP is powerless.

    That is, OOP allows you to define top-to-bottom relationships, but it is not suitable for defining left-to-right relationships. For example, the logging feature. Logs tend to be spread horizontally across all object hierarchies, regardless of the core functionality of the object it spreads to.

    In OOP design, it leads to a lot of duplication and is not conducive to the reuse of individual modules.

    Encapsulate the cross-cutting business logic (such as security, logs, transactions, etc.) in the program into a slice and inject it into the target object (specific business logic).

    The technology to realize AOP is mainly divided into two categories: one is the use of dynamic technology, which uses the way of intercepting messages to decorate the message to replace the execution of the original object behavior; The second is to use the static weaving method to introduce a specific syntax to create "aspects", so that the compiler can weave in the relevant "aspects" during compilation.

    To explain it simply, let's say you want to add a function to print 'hello' to all classes in your biz layer, which you can do with the idea of aop, you first write a class and write a method, and the method is implemented to print 'hello' and let you ioc this class ref "biz.".* "Let each class be injected."

  4. Anonymous users2024-02-03

    Spring's IOC container is the core of Spring, and Spring AOP is an important part of the Spring framework.

    In traditional programming, when the caller needs the assistance of the callee, it is usually the caller who creates an instance of the callee. However, the work of creating the callee in Spring is no longer done by the caller, so the Inversion of Control (IOC); The work of creating an instance of the callee is usually done by a spring container and then injected into the caller, so it is also called dependency injection (DI), and dependency injection and inversion of control are the same concept.

    Aspect-Oriented Programming (AOP) is to consider the program structure from another perspective and refine object-oriented programming (OOP) by analyzing the concerns of the program structure. OOP decomposes the application into layers of objects, while AOP decomposes the program into multiple slices. Spring AOP only implements method-level connection points, and in J2EE applications, AOP intercepts method-level operations sufficiently.

    In Spring, to make it easy for IOCs to use robust and flexible enterprise services in the future, Spring AOP will need to be leveraged to establish a link between IOCs and enterprise services.

  5. Anonymous users2024-02-02

    I'll give you an authoritative one, and you basically don't ask when you answer this.

    IOC (Invert Control): Control over the assignment of member variables is reversed from ** to the configuration file.

    AOP: Aspect Oriented Programming, Section-oriented programming.

    That's pretty much it.,And then it's Spring's transaction processing.,That's basically it.。

  6. Anonymous users2024-02-01

    Literal comprehension and answers can make yourself speak clearly and the listener can understand it clearly. IOC control reversal is a way of operation, or a generalization of ideas, who controls whom? Why is it reversed?

    Through the use of spring, you can know that the spring container controls all beans, and before spring, one bean depends on another bean and initializes another bean in this bean to use another bean, and this bean is controlling another bean. Now the spring container controls all the beans and injects another bean into the bean. Anti**

    Let's first understand the facets, what are what we call facets? Where do we cut the faces?

    Of course, we are talking about the aspects of the method, so what are the aspects of the method? After our learning, we can be in the front, back, and middle of the method. * This is a bit general.

    Specifically, before the method is called, after the method is returned, before the method is returned, when the method is called is abnormal, etc., you can insert your own related things in these places, and these things are facets. Next, how do we intervene in these things? Dynamic, whether it's for the interface or generating its subclasses, these techniques are to solve the problem of how to insert a slice, do you have any other way to solve the problem of how to insert a slice?

    Spring solves this problem, all we have to do is write the slice, configure the entry point of the slice, the slice type, and so on, and ......

  7. Anonymous users2024-01-31

    Design Pattern: An application of Dynamic.

  8. Anonymous users2024-01-30

    A lot of it.,Transactions.,Permissions.,Logs can be used.。

  9. Anonymous users2024-01-29

    Isn't that what you need when you add a transaction feature now?

  10. Anonymous users2024-01-28

    Whether you want to use it or not has to be decided by the company! Some companies use it, and some don't use it! Less use means that most companies are still useless.

Related questions
15 answers2024-02-25

The capital of the Southern Dynasties (i.e., Song, Qi, Liang, Chen) was in Jiankang (present-day Nanjing) Song: 420-479 Liu Yu Jiankang. >>>More

3 answers2024-02-25

During this time, the body and feelings should be carefully cared for.

47 answers2024-02-25

Nonsense !! I have short hair and eyes, and I still have good buddies >>>More

19 answers2024-02-25

If your boyfriend's behavior is causing you a lot of pain, then you tell him! >>>More

17 answers2024-02-25

2005 "The Ultimate Class" 2006 "Boys Over Flowers" 2007 "The Ultimate Family" 2010 "Sunshine Angel" 2005 "Mischievous Kiss".