from the code, but from the thought, the "master-slave Transposition" change. The application was originally the boss, to get what resources are active attack, but in Ioc/di thought, the application becomes passive, passively wait for the IOC container to create and inject the resources it needs.IOC is a good embodiment of the object-oriented design of one of the rules of Hollywood: "Do not call us, we find you", that is, the IOC container for the object to find the corresponding dependent obje
In spring, you can use the Dependency check feature to ensure that the required properties can be set or injected. Dependency Check mode 4 dependent check supported mode:
None – does not rely on check, which is the default mode.
simple– if the base type (int, long,double ...) and collection type (map, list..) Any of the properties are not set, Unsatisfieddependencyexception will be thrown.
Label:In the Java Web project, the inevitable use of the database, the following is the idea of adding MySQL dependency method. If you see this, it means you understand idea,maven and Tomcat, so ... Just add the dependencies in the Pom.xml, and here's my config file. XML version= "1.0" encoding= "UTF-8"?>
Projectxmlns= "http://maven.apache.org/POM/4.0.0"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "http://maven.apache.org/
PrefaceThe basic usage of caching is explained: I recommend looking at the ASP.In this article, I mainly write down the general SQL cache dependency, as well as the use of MVC Filter Database cache dependency.what is cache dependency1. Cache: is to put the resources you want to access, in memory, occupy a certain amount of memory space, so that the user read in-memory data, thereby reducing the number of read database, or resource files, thus to your
. Think of that before invoking the service from the controller is also invoked by an injected service singleton instance, which also proves that the method we provide is valid.
Iv. extension of the problem
4.1 Extension questions: Cyclic dependencies
As for another problem that arises: when we inject an instance of the current class into the current class, we need to inject an instance of this class when we create an instance of the class, but what if this class is created???
This is the famous
OrderThe first time I learned the concept of control inversion (inversion of controls) was when learning the spring framework. IOC and AOP, as the two characteristics of spring, are naturally going to learn well. and Dependency Injection (Dependency injection, short di) makes me confused for a long time, always trying not to understand the connection between them.Control reversalControl reversal as the name
OrderThe first time I learned the concept of control inversion (inversion of controls) was when learning the spring framework. IOC and AOP, as the two characteristics of spring, are naturally going to learn well. and Dependency Injection (Dependency injection, short di) makes me confused for a long time, always trying not to understand the connection between them.Control ReversalControl reversal as the name
1.Control Reversal(inversion of Control)and Dependency Injection(Dependency injection)Control inversion, the IOC (inversion of control), gives the container the right to assemble and manage object components by means of a container, by handing over the call of objects that are traditionally manipulated directly by the program code. The so-called "inversion of Control" concept is the transfer of control over
ObjectiveIn the article "Tiger Painting cat write their own spring" from scratch to tell and realize the following points
Declaring a configuration file that declares the class to be loaded using
Load configuration file, read configuration file
Parsing the configuration file, you need to convert the label declared in the configuration file to a class that fairy can recognize
Initializes a class that provides an instance of the class declared in the configuration file
In
How PHP programmers understand dependency injection containers (Dependency injection container)
Background KnowledgeThe traditional idea is that the application uses an Foo class, the Foo class is created and the method of the Foo class is called, and if a bar class is needed within the method, the bar class is created and the bar class is called, and the method requires a BIM class, creates the Bim class,
Tips"Effective Java, third Edition" an English version has been published, the second edition of this book presumably many people have read, known as one of the four major Java books, but the second edition of 2009 published, to now nearly 8 years, but with Java 6, 7, 8, and even 9 of the release, the Java language has undergone profound changes.In the first time here translated into Chinese version. For everyone to learn to share.
5. Replacing hard-connected resources with
Thank http://blog.xiaohansong.com/2015/10/21/IoC-and-DI/for the map
1. What is control. As shown in the following figure, we see the object in the software system
high coupling phenomenon. The rotation of all gears is controlled by an object., such as Class B.
2. What is control reversal. is used to object
to decouple。
Decoupling between objects that have dependencies with third-party implementations. This third party is the IOC container. Once the IOC container has been introduced,
there
Logical design of relational databaseFor the specific problem, how to construct a data pattern suitable for itA tool of database logic design--Normalization theory of relational databaseThe relationship pattern consists of five parts, that is, it is a five-tuple: D, DOM, F)R: 关系名U: 组成该关系的属性名集合D: 属性组U中属性所来自的域DOM: 属性向域的映象集合F: 属性间数据的依赖关系集合Data dependencyA constraint relationship between a relationship's internal property and a propertyAn abstraction of the
To understand the two concepts of PHP Dependency Injection and control reversal, you must be aware of the following issues:
Di--dependency Injection Dependency Injection
Ioc--inversion of Control inversion
1, who are the participants?
A : There are generally three participants, one is an object; one is a ioc/di container; the other is an external resource for
Four ways to rely on injection in springThere are three ways to configure dependency injection for a bean in the spring container:· This is the most common way to inject a setter method that uses attributes;· Using a constructor injection;· Use filed injection (for annotation mode).Use the setter method of the property to injectThe first thing to configure is the injected bean, which in the corresponding class of the bean should have the attributes of
Watching TV for a day in the daytime, one is because it is too hot, impatient the air to see the book, second, because this TV is pretty good, Zu Feng Woodstock Hou Yong. The Mask of the Act. TV good-looking, their efforts to make money to study hard to learn is the reality of the night and quarrel, really is a small noisy day, two days a big noisy; Reading, learning, appreciation, pay rise is the kingly way!!!Dependency injection also feel difficult
: ' Router '}; We have another function that needs to use these two modules. nbsp; Code as follows: var dosomething = function (other) {nbsp; nbsp; var s = Service () nbsp; nbsp; var r = router ();}; To make it look more interesting, this function takes a parameter. Of course, we can use the above code completely, but this is obviously not flexible. If we want to use Servicexml or Servicejson, or if we need some test modules. We can't just edit the function body to solve the problem. First, we c
code completely, but this is obviously not flexible. If we want to use Servicexml or Servicejson, or if we need some test modules. We can't just edit the function body to solve the problem. First, we can solve the dependencies by using the parameters of the function. That
Copy Code code as follows:
var dosomething = function (service, router, other) {
var s = service ();
var r = Router ();
};
We implement the functionality we want by passing additional parameters, howev
interface is defined, the development of things can be seamless connection.On the Java EE platform, the spring framework is used primarily to implement dependency injection. Here, we will make ourselves a dependency injection container.The theoretical basis of dependency injection is the abstract factory design pattern, which is briefly introduced in combination
-indexer-2.0.0-javadoc.jar and Nexus-indexer-2.0.0-sources.jar, through plugins that include Java documentation and source code. At this time, Javadoc and sources are the classifier of these two subordinate components. Such A subordinate member has its own unique coordinate. Note: The classifier of the project cannot be defined directly, because the subordinate artifacts are not generated directly by default, but are generated by the additional plug-in Help. The file name of the project artifac
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.