• Principle analysis of spring MVC (I)


    Servlet lifecycle understanding The life cycle of a servlet is managed by a container (eg: Tomcat). In other words, a servlet programmer cannot control its life with code. Load and instantiateWeb. Timing depends on: XML definition, if anyxWhen the container starts (eg: SSM), otherwise, when the first request for this servlet occurs (eg: spring boot). […]

  • Mybatis plug-in mechanism


    This article will talk about the plug-in mechanism of mybatis, which is based on myabtis version 3.4.6. Knowledge points What is a plug-in How to customize plug-ins Plug in implementation principle What is a plug-in I believe you must have used many plug-ins at ordinary times, such as Eclipse Plug-in, idea plug-in, Chrome browser plug-in, […]

  • Android 2-minute handwritten okhttp interceptor thoroughly understand the responsibility chain mode responsibility chain mode actual combat demo


    Some students say they can’t understand the responsibility chain mode, so I use 100 lines of code to write the interceptor to let you understand!!!! Excuse me: how can developer adjust the code format? I posted it in a different format. You go directly to GitHub to download the project! public class Request { public […]

  • Casbin of go permission management


    Casbin of go permission management Let’s review the go we shared last timegjsonLibrary application and sharing, which mainly provides aVery fastAndsimpleThe way fromjsonGet the corresponding value from the document SharedjsonAndgjsonWhat do they represent gjsonSimple use of gjsonCheck, get value gjsonofJSON line gjsonKey path matching rule for gjsonModifiers and custom modifiers for If yesgjsonIf you are […]

  • Kotlin collaboration + retro fit network request framework simple encapsulation


    preface Since the popularity of collaborative process, there have been too many articles and frameworks based on kotlin collaborative process + retrofit. Here is another version of the small framework implemented by ourselves. In fact, the framework is a simple encapsulation using collaboration + retrofit. It has to be said that it is really simple […]

  • Cglib agent


    explain Cglib is generated by operating bytecodeReality classTo forward the real methods in the subclass to the interceptor, and the interceptor calls it againReality classMethod of Code demo Reality class public class UserQueryImpl { Interceptor public class LogInterceptor implements MethodInterceptor { @Override public Object intercept(Object o, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { […]

  • Troubleshooting of cross domain problems caused by springcloud gateway + oauth2


    Project technical architecture:Front end: VueBack end: springcloud h version1. Gateway: Gateway(1) As a unified access portal for all resources, it needs to support cross domain(2) Rely on oauth2, use resource related APIs, and act as a resource server for permission authentication After the interface is written, the native machine uses postman to test, and the […]

  • Talk about how to integrate SPI with spring


    preface The last article mainlyTalk about how to implement an SPI with interceptor function。 Today, let’s talk about how to integrate custom SPI with spring. Thinking: what does the SPI we implement integrate with spring? Or what features of spring should we use to realize? In addition to the well-known IOC and AOP, spring also […]

  • Spring transaction management


    Transaction manager interface platformtransactionmanager Spring transaction management center interface public interface PlatformTransactionManager{ TransactionStatus getTransaction(@Nullable TransactionDefinition definition) throws TransactionException; void commit(TransactionStatus status) throws TransactionException; void rollback(TransactionStatus status) throws TransactionException; } Common implementation classes The transaction manager is usually initialized when the project starts. Take hibernate transaction manager as an example @Bean public HibernateTransactionManager transactionManager() { HibernateTransactionManager […]

  • Summary of some problems encountered this week


    Question 1: how to reference private librariesAt first, I thought that sincenode_modulesIt is used to store the installed package, so [email protected] innode_modulesJust go inside.After trying, it is found that although functions in the library can be used, the system does not automatically reference functions when they are directly [email protected], manual introduction is required.After inquiry, it […]

  • Java – springboot add custom interceptor


    Late one night, Nicholas Li Si had a whim: print the request log for the 10 interfaces he wrote during the day. The log content is also very simple. Just print the interface address and request parametersBut the code for printing the request log doesn’t want to be written in all 10 interfaces. What should […]

  • Viewing the mechanism of mybatis plug-in through PageHelper


    A plug-in, or plugin, is essentially a series of interceptors to facilitate user-defined extensions.Four expansion points are reserved: Executor (update, query, flushStatements, commit, rollback, getTransaction, close, isClosed) ParameterHandler (getParameterObject, setParameters) ResultSetHandler (handleResultSets, handleOutputParameters) StatementHandler (prepare, parameterize, batch, update, query) Next, take PageHelper as an example to see how it implements the executor extension. 1、 What […]