Springboot extension point series_SmartInitializingSingleton

Features 1. SmartInitializingSingleton is mainly used to perform expansion operations when the Spring container is started, that is, afterSingletonsInstantiated(); 2. The scope of the bean that implements the SmartInitializingSingleton interface must be a singleton, and only afterSingletonsInstantiated() will be triggered; 3. When afterSingletonsInstantiated() triggers execution, the non-lazy-loaded singleton bean has completed implementation, property injection, and […]

InitializingBean is executed 2 times in the springmvc project

In order to repair the production data, a one-time piece of code needs to be executed. Since it is an old spring project, I thought of InitializingBean. code show as below. After the service started, two “one-time task started” entries were found in the log. Fortunately, the logic inside has been controlled to prevent duplication, […]

gyp ERR when initializing the uniapp project

After reinstalling the computer, node 18.16.1-x64 was installed, and I encountered no problems when writing back-end code. When the uniapp project is initialized, gyp ERR is reported. The specific error is as follows: npm ERR! code 1 npm ERR! path D:\postman\hksvn\project\uniapp*\ ode_modules\ ode-sass npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node […]

tensorflow builds a simple CNN, including OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already in

csdn reference Dataset introduction Cifar-10 is a computer vision data set for universal object recognition collected by Hinton’s students Alex Krizhevsky and Ilya Sutskever. It contains 60,000 32 X 32 RGB color images, with a total of 10 categories. Among them, 50,000 images are used for training set and 10,000 images are used for test […]

ApplicationRunner, InitializingBean, @PostConstruct execution sequence

Overview There may be scenarios in development where you need to execute something when the container starts. For example, reading configuration files, database connections, etc. SpringBoot provides us with two interfaces to help us achieve this requirement. The two startup loading interfaces are: CommandLineRunner and ApplicationRunner. Spring provides the interface InitializingBean, and jdk provides @PostConstruct […]

Spring extension interface InitializingBean

Directory 1. Environment Two, examples 2.1. Description 3. Execution process 3.1 Source code analysis One, environment jdk: 1.8 spring-boot: 2.7.1 Second, Example @Component public class TestInit implements InitializingBean { @Override public void afterPropertiesSet() throws Exception { System.out.println(“call TestInit.afterPropertiesSet method”); } } operation result: 2.1, Description springboot provides the InitializingBean interface, which users can implement to […]

Initializing the superset database error

miniconda change source Create a virtual environment error Solution: 1. vim ~/.condarc 2. Replace the contents with channels: – defaults show_channel_urls: true channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda default_channels: – https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main – https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free – https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r – https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro – https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 custom_channels: conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud See the blog: Solve the problem that […]

A so easy problem encountered when initializing with mybatis-plus

I encountered a problem when I introduced mybatis-plus into my own project. After studying the error report for a long time, I finally saw the last caused by and found that the id column was not mapped. That’s it, it’s a very low-level mistake. java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) […]

In SpringBoot, enumeration classes, switch, and constant classes (declaring and initializing map) are used to implement the class strategist mode, and the interface returns constant data

Scene Strategy mode + factory mode business instance in SpringBoot (interface parameter transfer-enumeration class query strategy mapping relationship-execution of different strategies) avoids a large number of if-else: Strategy mode + factory mode business instance in SpringBoot (interface parameter transfer-enumeration class query strategy mapping relationship-execution of different strategies) to avoid a large number of if-else_Overbearing rogue […]