preface

A Java framework learning about one to two months can be more skilled use of it, but want to master a framework needs to be familiar with its various underlying principles and working mechanism, which is not a matter of one or two months, you need to keep learning to achieve great success.

Learning Java framework must do practice while learning theory, knowledge into practice, because Java is object-oriented language, need to understand a lot of abstract concepts, some people call learning Java process as learning “abstract” process. On the one hand, practice exercises hands-on ability, on the other hand, it establishes the “knowledge frame model” of concepts through practice.

The main framework for Java

One, for SpringMVC

Spring Web MVC is a lightweight Web framework based on Java that implements the request-driven type of Web MVC design pattern, which uses the idea of MVC architecture pattern to decouple the responsibilities of the Web layer. Request-driven refers to the use of request-response model. The purpose of the framework is to help simplify development. Spring Web MVC is also meant to simplify our daily Web development.

Spring MVC Interview

The Model encapsulates the application’s data and the POJOs they generally compose.

The View is responsible for rendering model data and generally the HTML output it generates, which can be interpreted by the client’s browser.

The Controller is responsible for processing the user’s request, creating the appropriate model, and passing it to the view rendering.

Spring’s Web Model-View-Controller (MVC) framework is designed around a DispatcherServlet that handles all HTTP requests and responses.

Spring Web MVC handles the flow of requests

1, first of all, the user sends a request ————> front-end controller, front-end controller according to the request information (such as URL) to decide which page controller to process and entrust the request to it, that is, the control logic part of the previous controller; Steps 1 and 2 in Figure 2-1;

2. After receiving the request, the page controller performs functional processing. First, it needs to collect and bind the request parameters to an object, which is called command object in Spring Web MVC, and verify it, and then delegate the command object to the business object for processing; Return a ModelAndView (model data and logical view name) after processing; Steps 3, 4, and 5 in Figure 2-1;

3. The front-end controller takes back control, and then selects the corresponding view for rendering according to the returned logical view name, and passes in model data for view rendering; Steps 6 and 7 in Figure 2-1;

4. The front-end controller takes back control again and sends the response back to the user, as shown in Step 8 in Figure 2-1. That’s the end of it.

Second, the Spring

Spring is popular with enterprises. Spring uses basic Javabeans to do things that were previously only possible with EJBs. However, Spring’s use is not limited to server-side development. The vast majority of Java applications can benefit from Spring in terms of simplicity, testability, and loose coupling.

Third, Mybatis

MyBatis is an excellent persistence layer framework that supports ordinary SQL queries, stored procedures, and advanced mapping. MyBatis eliminates almost all manual setting of JDBC code and parameters and retrieval of result sets. MyBatis uses simple XML or annotations for configuration and raw mapping to map interfaces and Java’s POJOs(PlainOldJavaObjects, plain Java objects) to records in the database.

Other Java frameworks include Dubbo, Maven, RabbitMQ, Log4j, Ehcache, Redis, Shiro. You don’t need to learn all of these frameworks, just a few of the more common ones will suffice.