Spring in my eyes

xiaoxiao2021-03-06  44

After a period of time with Spring, I recently made a Spring training inside the department. A natural problem, Spring is good? I can put a lot of advertisements, but that is not my feelings. So, I ask yourself and ask a question that belongs to myself. Dependency Injection. It is called IOC. Martin Flower is a message, it is an IOC, which is not enough to reverse the "specific implementation of the plug-in", so it has a new name, Dependency INJECTION. In fact, it is an idea that divides the caller with the caller, the uncle bob is called DIP (Dependency Inversion Princi), and it is classified into the OO design principle. Compared with Spring, it entered my brain earlier. Everything is so embarrassing until Spring appears. Slowly, I know it is also divided into interface injection (Type 1), Setter Injection (Type 2), constructor injection (Type 3). Martin Flower's masterpiece made me feel about it about it. In Spring, it is the foundation of everything. The advantages of spring come. As I said, it brings me more ways to think, I am afraid that I will never write the full-featured program. Dynamic configuration The dynamic configuration mentioned herein includes two parts: system generation and system modification. Spring-based applications are organized by profiles, which means that the programs we have written, more are in completing the specific features, and the series between the functions, it will rely on the configuration file. The advantage that the advantage is that we can change system behavior without recoiling the code. Perhaps not modifying code can be another reason, but in my opinion, there is no nature difference between the modification of the Java code and modify the configuration file, as long as you can treat the configuration file as another language, isn't it? A colleague asked me if the correctness of the Spring configuration file can only be found when it is runtime, and the truth is like this. Every time you modify the configuration file, then run it to determine its correctness, this is really a matter of hard work. If you are an Eclipse user, you are more happy, and some people have developed Spring plugins to help you complete this work. The easy-to-test structure once once at the scene, I changed a simple small bug, simply to the code that was changed, no more than five lines. But from I locate the error to complete the bug correction, for more than two hours, this makes two companions to only be angry with me. This is why I have my own confused, and the code is not effective. Every time you modify a sentence, you should deploy it to the application server and run the results. I believe that each person who has experienced application experience on the application server knows how long the process is. If you said to me, for a good application, testedness is also very important. I put a very disdainful attitude, and the painful lesson is completely educated me. Dependency Injection allows the entire application structure to be clearly tested for each specific module, without having to put it through the entire application to the application server, can be tested. The local stability brings more confidence that when the system is integrated, confidence is getting more and more. A colleague in the interface pressure project group said to me, using Spring and useless.

转载请注明原文地址:https://www.9cbs.com/read-77009.html

New Post(0)