Tag:Single case

  • Swift22/90Days – GCD 1


    Swift90Days – GCD 1 I’ve been busy recently, so I’ll post the key code when I study, and I’ll fill in the content when I have a chance in the future. dispatch_async Look at the code and speak: dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ UIImage *overlayImage = [self faceOverlayImageFromImage:_image]; dispatch_async(dispatch_get_main_queue(), ^{ [self fadeInNewImage:overlayImage]; }); }); The above code […]

  • @Difference between component and @configuration


    At the first sight of this topic, I believe everyone will come up with an idea: aren’t these all spring annotations? The classes with these two annotations will be finally encapsulated into beandefinition and handed over to spring management. What’s the difference? First of all, let me show you a sample code:AnnotationBean.java import lombok.Data; import […]

  • Spring source code analysis: the creation process of bean instances (I)


    In the previous article, I briefly introduced the loading process of bean definitions. The main content of the following article is the creation process of bean instances. How to create bean instances ApplicationContext context = new ClassPathXmlApplicationContext(“application.xml”); context.getBean(“beanDemo”); First of all, see the above code, which uses the getBean method. Is the entry to create […]

  • Design mode – create mode – singleton mode (c++)


    1. Foreword Singleton mode is a creation mode, which ensures that a class has only one instance and provides a global access point to access it. The singleton mode ensures that a class has only one instance, and instantiates itself and provides this instance to the whole system. This class is called a singleton class, […]

  • Google’s open source dependency injection is smaller and faster than spring!


    Guice is an open source dependency injection Library of Google, which is smaller and faster than spring IOC. Elasticsearch uses Guice a lot. This article briefly introduces the basic concepts and usage of Guice. Learning objectives Overview: understand what Guice is and what its characteristics are;Get started quickly: learn about Guice through examples;Core concepts: understand […]

  • Auto swagger automatically crawls interface files


    Auto-Swagger auto-swaggerIt is a command-line tool that crawls the swagger UI and generates the requested interface file. It is designed to help interface callers generate interface code files with one click. Delivery address: https://github.com/pablezhang/auto-swagger Why do you want to do auto swagger? In work, background development students usually provide a swagger interface document. Front end […]

  • Introduction to the advantages of using laravel service container


    If the core of the laravel framework is anything, it is undoubtedly a service container. Understanding the concept of service container is too important for us to use laravel. It should be said that whether we understand the concept of service container is an important condition to distinguish whether we are starting laravel or not. […]

  • Singleton mode of design mode


    Introduction: The so-called singleton design pattern is to take certain methods to ensure that there can only be one object instance for a class in the whole software system, and the class only provides a method (static method) to obtain its object instance. For example, hibernate’s sessionfactory acts as a proxy for the data storage […]

  • Spring (1) -applicationcontextaware details


    Detailed explanation of applicationcontextaware 1、 Get to the point Aware originally means “automatic”. As the name suggests, spring does something for us automatically. Spring has many classes ending in aware, including environmentaware, applicationcontextaware, messagesourceaware, etc. Here I mainly talk about applicationcontextaware. As quoted below, the documentation of applicationcontextaware can be readSpring Core Technologies 1.4.6 Method […]

  • Spring’s bean definition information registration process


    Core annotation self inspection annotation function @Bean Register components in container @Primary If there are multiple components of the same kind, mark the main component @DependsOn Declare dependencies between components @Lazy Lazy loading of components (created when used last) @Scope Declare the scope of the component (scope_prototype, scope_singleton) @Configuration Declare that this is a configuration […]

  • Xcode snippets/objective-c learning


    preface Xcode-SnippetsIt is a pile of open source code on GitHub. Author Mattt shared his Xcode snippets. Today, let’s learn about them. fragment singleton.m + (instancetype)shared<#name#> { static <#class#> *_shared<#name#> = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ _shared<#name#> = <#initializer#>; }); return _shared<#name#>; } Singleton, standard code. stack.m NSLog(@”Call Stack: %@”, [NSThread callStackSymbols]); This is […]

  • Creation type: I Singleton mode


    What is the singleton mode The singleton pattern is a creative design pattern: the singleton pattern ensures that a class has only one instance and provides a global access point to access it. Why use singleton mode Why use singleton mode? For some objects in the system, we only need a global one, and each […]