Let’s try to understand Spring IOC by looking at the code instead of talking big.
As we all know, spring container load bean from xml file. How this
Let’s look at the structure of BeanFactory.
The sky isn't that so high so I will never give up
Let’s try to understand Spring IOC by looking at the code instead of talking big.
As we all know, spring container load bean from xml file. How this
Let’s look at the structure of BeanFactory.
As a good programmer, one should keep track of instantiated objects and control the object creation in an application.
Design pattern is a set of conclusive solutions to those frequently appeared problems.
The design patterns help you to write flexible, low-coupled, high-cohesive code.
In stead of think design pattern as a technical thing, try to think it as art. Actually it is art.
Learn design pattern in following ways
1. Motivation(what is cons of not using this pattern, real use case as example)
2. Implementation(how to implement pattern in code level)
3. Pros and cons
4. Pattern correlations(how patterns are similar to each other, and how patterns can work together)
There are three types of design patterns:
Considering that you are facing this situation: you built a
Decouple client and subsystem
adheres to the Principle of Least Knowledge,
Abstraction of the interface? Yes
hello
Future interface provider developers ability to run async tasks. It provides two method: isDone() and get().
The motivation to have completable future is that Future interface is insufficient in the following cases.
CompletableFuture has many methods to support the above disadvantages. Now let’s look at some most used methods of CompletableFuture.
complete()
With this method, we can manually complete the async task.
CompletableFuture future = new CompletableFuture();
future.complete("Manually complete task.");
CompletableFuture provides us two method to set callback function for async task: supplyAsync() and runAsync(). The different is that supplyAsync() will return value, and runAsync() just run an async task. Let’s look at the code.
supplyAsync()