[Interview] Framework and personal projects

Two, reference

1. Frame

1、XML配置和注解配置各自优缺点

2、MVC了解吗?(*23、Spring是什么,主要IOC等等
 - 追问1:Spring 核心是 IoC 容器,你能说说IoC(控制反转)吗?
 - 追问2:Spring AOP(Aspect-oriented programming)是什么?
 - 追问3:Spring中的动态代理模式?
   ……
 - 追问4:注册Bean有几种?分别什么特点?
 - 追问5:Spring中涉及的一些设计模式?
   ……
 - 追问6:项目中怎么用Spring的?
   ……
   
4、Spring Boot的缺陷是什么?
 - 追问1:Spring、Spring Boot和Spring Cloud区别?

5、手撕反射私有变量,反射泛型方法
   ……

2 people

1、决策树是什么?

1. Content

1. The advantages and disadvantages of XML configuration and annotation configuration

Attributes advantage Disadvantage
XML Loosely coupled, separate code and configuration Adding xml files, troublesome modification, uncertain conditions (ifelse judgment), error-prone, special escape characters such as greater than less than
annotation Tight decoupling, flexible Complex sql is not easy to use, it is inconvenient to collect sql, and it is inconvenient to manage. Modifications need to be recompiled

2. Do you understand MVC? (*2)

Development model content advantage Disadvantage
Model1 JSP+Servlet Separation of logic and display functions The view layer and the control layer are not separated, both are implemented by JSP pages
MVC Model+View+Controller Simple project iteratively launches quickly JSP is low efficiency, unclear division of labor, not conducive to project evolution
Front and rear separation Front-end: View+Front-end Controller; Back-end: Controller+Service+DAO Front-end and back-end decoupling, performance improvement, good business scalability, low development and deployment pressure High front-end requirements and high communication costs
补充:
1、JSP & Servlet容器
JSP(Java Server Pages):一种动态网页开发技术。使用JSP标签在网页中插入Java代码来获取用户输入数据、访问数据库和动态创建网页。
Servlet容器/JavaWeb应用容器/JSP容器:为JavaWeb应用提供运行时环境,主要负责管理Servlet、JSP的生命周期以及它们的共享数据。

2、MVC介绍
Model层:使用JavaBean编写,接受视图层请求并返回处理结果,最核心。JavaBean实现代码重用和扩展维护。
View层: 代表和用户交互界面,负责数据采集和展示,通常由JSP实现。
Controller层:从用户端接收请求,然后传递给模型层,协调View和Model层工作,一般交由Servlet实现。

常规组合:Spring + Structs/Spring MVC + Hibernate/Mybatis

3、前后端分离(RESTful API通信)
前端:前端控制层、视图层
后端:控制层、服务层、数据访问层。

3. What is Spring, main IOC, etc.

Spring is an open source lightweight Java SE/EE development application framework that can help manage object dependencies and database transactions, provide aspect-oriented capabilities such as general logging, security control, and exception handling. It can also interact with third parties such as MyBatis and Spring MVC. Framework integration.

Follow-up 1: The core of Spring is an IoC container. Can you talk about IoC (Inversion of Control)?

Ioc, Inversion of Control, or "inversion of control". It is not a technology, but a design idea.

  • 1) What to control and what to reverse : Forward rotation — Traditionally, the program actively creates and controls dependent objects ; Reverse — The container helps to create and inject dependent objects , and obtain external resources (objects & files, etc.).

  • 2) Contrast : The creation of dependent objects within the traditional class will lead to high coupling between the class and the class, which is difficult to test; but now let the container create and control (find, inject, control) dependent objects, so the objects are loosely coupled, which is convenient for testing and beneficial Function reuse and flexible program architecture.

1

Follow-up 2: What is Spring AOP (Aspect-oriented programming)?

Aspect-oriented programming is a supplement to object-oriented programming. Simply put, it is an interceptor that intercepts some processing .

例如Spring AOP 能劫持正运行 method,在执行前或后加入一些额外的功能。有4种类型通知:

1)Before advice - method 执行前通知。
2)After returning advice - method 返回一个结果后通知。
3)After throwing advice - method 抛出异常后通知。
4)Around advice - 环绕通知,结合了以上三种
Follow-up 3: Dynamic proxy mode in Spring?

The implementation basis of Spring AOP is JDK dynamic proxy and CGLIB dynamic proxy.
Agency model
The specific meaning, source code details are slightly...

1、代理(Proxy)是一种设计模式,访问方式是通过代理对象访问目标对象。
   好处:可以在目标对象实现的基础上,增强额外的功能操作,即扩展目标对象的功能;
   用到的编程思想:不要随意去修改别人已经写好的代码或者方法,如果需修改,可以通过代理的方式来扩展该方法

举例:想邀请一位明星,那并不是直接连接明星,而是联系明星的经纪人,来达到同样的目的.
      明星就是一个目标对象,他只要负责活动中的节目,
      而其他琐碎的事情交给代理人(经纪人)来解决。

2、Java有三种代理模式,静态代理、JDK动态代理和CGLIB动态代理。
Follow-up 4: How many kinds of registered beans are there? What are the characteristics?

1) Package scanning + component annotation annotation
2) @Bean annotation
3) @Import annotation
4) Using BeanfactoryFactoryBean (factory bean)

……

Follow-up 5: Some design patterns involved in Spring?

Engineering mode.

Follow-up 5: How to use Spring in the project?

……

4. What are the shortcomings of Spring Boot?

Attributes advantage Disadvantage
content Annotation simplifies configuration, [embedded container, such as servlet, tomcat] container simplifies deployment, and [xxx-actuator] sets operation monitoring, which is more lightweight If you do not configure yourself, it is difficult to locate errors when reporting errors; the integration is high and it is difficult to understand the bottom layer
summary Based on Spring, simplify configuration, monitoring, deployment, and coding Package integration, not easy to understand the bottom layer

3

Follow-up 1: What is the difference between Spring, Spring Boot and Spring Cloud?

Spring is an ecosystem that can integrate many frameworks, such as database and Web management;

Spring Boot annotations, embedded containers, etc. can simplify configuration, deployment, monitoring and development, making it easy to start projects with minimal cost;

Spring Cloud is a set of Spring Boot-based microservice solutions, providing many tools, such as configuration management, registry, service discovery, current limiting gateway, link tracking, etc.

5. Reflect private variables and reflect generic methods

……

two people

1. What is a decision tree?

Decision Tree (Decision Tree) is based on the known probability of occurrence of various situations , by constructing a decision tree to obtain the probability that the expected value of the net present value is greater than or equal to zero, evaluate project risk, and determine its feasibility. A graphical method of intuitive use of probability analysis.

A decision tree is a predictive model ; he is represented as a mapping between object attributes and relationships object values . Each node in the tree represents an object, and each bifurcation path represents a possible attribute value, and each leaf node corresponds to the object represented by the path from the root node to the leaf node. value. The decision tree has only a single output. If you want to have a complex output, you can build an independent decision tree to handle different outputs. Decision tree is a frequently used technique in data mining, which can be used to analyze data, and it can also be used to make predictions.

The essence is the process of classifying data using a series of rules .

Three, reference

1. The advantages and disadvantages of mybatis annotations and xml 2. The advantages and disadvantages
of annotations and xml configuration [transfer]
3. Spring IoC container
4. Things about Spring AOP and proxy mode in the interview
5. Four ways to register Bean through Spring annotations
6 , rapid understanding Spring Boot technology stack
7, the interviewer asked me: the difference between spring, springboot, springcloud, I laughed
8, before the final end the practice of project Detailed

Guess you like

Origin blog.csdn.net/HeavenDan/article/details/113255232