Tag:factory

  • RabbitMQ-5. Message production and consumption

    Time:2022-6-10

    1. concept 2. actual combat 2.1 basic logic First, create the producer class. Previously, we learned the architecture of rabbitmq, so when sending or consuming messages, we first need to create a factory, then configure the connection information of rabbitmq, then create a connection, then create a channel, and then send or consume messages 2.2 […]

  • Design pattern part: implementation of abstractfactorypattern

    Time:2022-6-4

    Compared with the factory pattern, each factory in the abstract factory pattern can create a product family instead of a product; Technologies used in the abstract factory: interface, polymorphism, configuration file, reflection; Design principles of abstract factory pattern: To realize the separation of creating products and using products by the client, the client does not […]

  • Creation type: IV Factory method mode

    Time:2022-5-31

    What is the factory method pattern Factory method pattern is a kind of creation design pattern. It provides a method to create an object in the parent class and allows the subclass to determine the type of instantiated object. Why use factory method mode When adding a new product, you do not need to modify […]

  • Retrofit LiveDataCallAdapterFactory

    Time:2022-5-29

    Retrofit can automatically parse objects after accessing the network, which is very smooth. To use this function, you only need to add addconverterfactory (gsonconverterfactory. Create()), add a gson parsing factory, or rxjava2calladapterfactory with rxjava. When the interface succeeds, it is parsed into observable objects to return. Now MVVM mode is popular. More and more people […]

  • This time I finally understand how Axios interrupts the request

    Time:2022-5-28

    Axios document cases Take a look at the examples given in the Axios documentationhttps://github.com/axios/axio… adoptCancelToken.sourceFactory function to cancel const CancelToken = axios.CancelToken; const source = CancelToken.source(); axios.get(‘/user/12345’, { cancelToken: source.token }).catch(function (thrown) { if (axios.isCancel(thrown)) { console.log(‘Request canceled’, thrown.message); } else { // handle error } }); axios.post(‘/user/12345’, { name: ‘new name’ }, { cancelToken: […]

  • Creative: v Abstract factory pattern

    Time:2022-5-26

    What is the abstract factory pattern Abstract factory is a kind of creative design pattern, which is used for the construction of product family. It can create a series of related objects without specifying their specific classes. Why use the abstract factory pattern In the factory method mode, specific factories are responsible for producing specific […]

  • Mybatis source code – sqlsession access

    Time:2022-5-9

    preface Known inMybatisIn useMybatisThe configuration file will be read firstmybatis-config.xmlFor character stream or byte stream, and then throughSqlSessionFactoryBuilderBuild based on the character stream or byte stream of the configuration fileSqlSessionFactory, and then passSqlSessionFactoryofopenSession()Method acquisitionSqlSession, the sample code is shown below. public static void main(String[] args) throws Exception { String resource = “mybatis-config.xml”; SqlSessionFactory sqlSessionFactory = […]

  • . net design pattern (2): 1.2 abstract factory pattern

    Time:2022-5-6

    summary Abstract factory pattern is the most abstract and general of all factory patterns. Abstract factory pattern refers to a factory pattern used when there are multiple Abstract roles. The abstract factory pattern can provide an interface for the client to create product objects in multiple product families without specifying the specific products. definition Abstract […]

  • Source code analysis: spring boot startup process (I)

    Time:2022-5-5

    Write in front Because I also read some corresponding spring related source code reading videos and articles first, but I still know a little about this part and am lazy, so I urge myself to read it as a whole in the way of recording. There will be many omissions. Please forgive me. The ultimate […]

  • Creating patterns for detailed explanation of design patterns — single example, prototype and factory

    Time:2022-5-3

    catalogue What is a design pattern Create mode Singleton pattern Prototype pattern Factory pattern Sinple factory pattern Factory method pattern Abstract factory Plant model summary I believe that as a program development, we have more or less contacted and even used design patterns, and we are even familiar with the concepts of some design patterns. […]

  • Springboot integrates redis to configure multiple library switching

    Time:2022-5-2

    The spring boot project uses redis 1. Directly introduce spring boot starter data redis dependency Gradle introduces dependency implementation ‘org.springframework.boot:spring-boot-starter-data-redis’ 2. In application Add redis configuration to YML spring: redis: host: 10.111.11.111 port: 6379 database: 1 3. You can directly inject redistemplate into srevice layer @Autowired RedisTemplate<String,String> redisTemplate; The above is the basic usage, but […]

  • Three common methods of t-test and examples used in Python

    Time:2022-4-30

    T-test is a statistical technique that can tell people how significant the difference between two groups of data is. It is achieved by comparing the semaphore (measured by the difference between samples or population averages) with the amount of noise (or change) in these samples. There are many useful articles that will tell you what […]