First of all, the interview series has been updated to the third article, the two updated articles, it can be said that Xiaohai encountered a lot of problems, the first question, published the second article, Linux knowledge points, some people say that the editor got it It's too simple and useless. Here, Xiaohai hereby declares that I only write articles for those who need interviews. After all, these are high-frequency interview questions, which are easy to encounter, not What a profound question, I am updating interview questions, not explaining knowledge points, I hope you can quickly memorize, and then interview for a good job. If you like in-depth research, please wait for the editor to update the red series, and there will be depth in the later stage. Parse the article. Please wait, Xiaohai just wants more people to find a job first, and study after having a job. The second question, Xiaohai did not encounter many interview questions himself. In order to better serve everyone, I hope everyone Leave a lot of messages for Xiaohai to organize and publish, thank you.
If you want to see the first two, I will send you a portal
Java interview Linux essential knowledge points, kill the interviewer, start with me
Spring Main Interview Questions
The question about Spring is mainly around Ioc and AOP , which everyone must be able to guess with their eyes closed.
Next, we remember some high-frequency problems
Design Patterns Used in Spring
Factory mode : IOC container proxy mode : AOP strategy mode : When spring adopts dynamic proxy, there are two proxy modes, JDK and CGLIB , according to whether the proxy class implements the interface or not , which is the singleton mode implemented by the strategy mode : by default, spring There is only one instance of the bean in
There must be others, I hope you leave a message to make up, I hope you can take a look at these design patterns by the way
Talk about IOC and AOP in Spring
The core of IoC is dependency inversion, which entrusts the creation of objects and the dependency management between objects to the IoC container to complete the decoupling between objects.
AOP mainly uses the proxy mode to extract the parts that are used by many interfaces and have nothing to do with the main business logic of the interface itself, write it into an aspect, and maintain it separately, such as permission verification. This can make the interface conform to the " single responsibility principle " , only focus on the main business logic, and also improve the reusability of the code.
Application scenarios of AOP
Permissions, logs, handling exceptions, transactions, etc., my personal understanding is to extract the parts that are used by many interfaces and have nothing to do with the main business logic of the interface itself, write them into an aspect, and maintain them separately, such as permission verification. This can make the interface conform to the " single responsibility principle " , only focus on the main business logic, and also improve the reusability of the code.
How to unify coding in Spring
Configure the interceptor
<filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
What is Spring Framework
The Spring Framework is a Java platform that provides comprehensive and extensive basic support for the development of Java applications . Spring helps developers solve basic problems in development, allowing developers to focus on application development. The Spring framework itself is also carefully built according to design patterns , which allows us to integrate the Spring framework in the development environment without worrying about how Spring works in the background.
What modules does Spring have
Spring framework has integrated more than 20 modules so far. These modules are mainly divided into core containers, data access / integration , Web , AOP (aspect-oriented programming), tools, messages and test modules as shown in the figure below
What are the configuration methods of Spring
There are three ways to configure Spring into application development:
1. XML - based configuration
2. Annotation-based configuration
3. Java - based configuration
Spring Bean life cycle
Spring Bean life cycle is simple and easy to understand. When a bean instance is initialized, a series of initialization operations need to be performed to achieve a usable state. Similarly, when a bean is not called, it needs to be destructed and removed from the bean container.
The Spring bean factory is responsible for managing the lifecycle of beans created in the spring container . The life cycle of a bean consists of two sets of callback ( call back ) methods.
1. The callback method called after initialization.
2. Destroy the callback method called before.
Xiaobian's message
Update these today, and there will be more interview questions in the series of Saohong later, every night at six o'clock, update on time, remember our slogan, kill the interviewer, start from me, so stay tuned ~