Spring Boot + Vue3 front-end separation actual combat wiki knowledge base system

 Spring Boot core knowledge system

· Vue3 family bucket actual combat landing

· Standard front-end and back-end development model

Meet the mainstream
norms and standards of the enterprise

· Enterprise-level coding style

· Standardize Git operation and release process

· Supporting universal front and rear components + tools

Comprehensive technical application, detailed explanation is only

Solve the problem of front-end separation

Front-end and back-end function integration, integrated HTTP component Axios, to solve common problems in the front-end and back-end separation architecture, such as cross-domain, parameter transfer, multi-environment configuration, etc.

Landing practical engineering projects

Covers logs, configuration files, hot deployment, Git, Maven, back-end interface unified return parameter design, package unified request return parameters, tool class package

Spring Boot core skills

AOP, interceptors, filters, asynchronization, timing tasks, WebSocket, caching, message queues, exception handling, multiple environments, etc.

Summarize and sort out high-frequency interview questions

After each chapter, the knowledge will be sorted out, and the classic high-frequency interview questions will be discussed together, so that the knowledge will be more firmly grasped and the interview will be more effective.

We have learned to integrate Filter in Spring , essentially registering Spring-managed Beans in the Servlet container through a proxy, but the steps are more cumbersome and require configuration web.xml.

In Spring Boot, adding one Filteris simpler and can achieve zero configuration. Let's take a look at how to add in Spring Boot Filter.

Spring Boot will automatically scan all FilterRegistrationBeantypes of Beans, and then Filterautomatically register them in the Servlet container without any configuration.

Let's take AuthFilteran example and write one first AuthFilterRegistrationBean, it inherits from FilterRegistrationBean:

@Order(10)
@Component
public class AuthFilterRegistrationBean extends FilterRegistrationBean<Filter> {
    @Autowired
    UserService userService;

    @Override
    public Filter getFilter() {
        return new AuthFilter();
    }

    class AuthFilter implements Filter {
        ...
    }
}

FilterRegistrationBeanNot Filterin itself , it is actually Filtera factory. Spring Boot will call getFilter()and Filterregister the returned to the Servlet container. Because we can FilterRegistrationBeaninject the required resources in, and then, in the return AuthFilter, this inner class can reference all the fields of the outer class, naturally including the injected ones UserService, so the whole process is completely based on Spring's IoC container.

Note that one is AuthFilterRegistrationBeanmarked again @Order(10), because Spring Boot supports multiple Filtersorts, with the smallest number in the front, so the multiple Filterorder can be fixed.

Let's write another one ApiFilterspecifically to filter /api/*such URLs. First write aApiFilterRegistrationBean

@Order(20)
@Component
public class ApiFilterRegistrationBean extends FilterRegistrationBean<Filter> {
    @PostConstruct
    public void init() {
        setFilter(new ApiFilter());
        setUrlPatterns(List.of("/api/*"));
    }

    class ApiFilter implements Filter {
        ...
    }
}

Link: https://pan.baidu.com/s/1y4PcAIwc4RtNPFqyvuYk6g 
Extraction code: hk8v 

Let's study hard together, come on.

 

Guess you like

Origin blog.csdn.net/weixin_46704535/article/details/114061002