I didn't go to bed last night. I thought I could go home from work and then snore. After dinner, I woke up. So I decided to advance the part I planned to write tomorrow.
Why don't I go to bed in the middle of the night? Pretend to be Wang zuxian
According to the previous requirements, we found that the configuration file needs to be abstracted into a component, and the cache needs a separate component. In order to adapt to different databases, we need to build a plug-in architecture, insert different processing components for different databases. To reduce the reflection cost, a component is required to include the interface definition. The main class is a loader that provides a loading and starting environment for data processing components.
In this way, we defineProgramThe structure is as follows:
Main project
Yourname. DB
Configuration
Yourname. DB. config
Interface
Yourname. DB. Interface
Data component plug-in
Yourname. DB. executer
Remember to replace yourname with your own name. Of course, I don't mind writing your own name.
A temporary contract can be formed between two unrelated projects by providing an interface ticket for another project to avoid the issue of circular reference.
Sleep. nap for a while. If it doesn't shine the day after tomorrow, let's continue to talk about how to implement real-time loading configuration.