Do I still need someone to help me when designing and implementing a management system based on the SSM framework? Doing it by yourself is the last word.

Most people's explanations of the SSM framework are rather blunt. In order to make it clear to students who want to use the SSM framework for design, I will use a simple and vivid metaphor to describe my experience.

When Spring sees this, many people will tell you what inversion of control (IoC), dependency injection (DI), AOP, transactions...what the hell are these for newbies? I will not write a definition for inversion of control, just talk about your computer. You have a USB port on your computer, and an HDMI port. What keyboard is used on the computer does not depend on the computer itself, but what is the keyboard plugged into the usb? Can understand this. You see, the input device that controls the computer is not controlled by the computer, but controlled by the keyboard you plug in. Isn't this control reversed? Dependency injection is inversion of control. The computer's input device depends on what keyboard it is plugged into. Insert the mechanical keyboard, the input device is the mechanical keyboard, and insert the numeric keyboard to input only numbers. From the perspective of keyboard insertion: from the perspective of the computer, it is dependency injection, what is the input device and what is the keyboard for dependency injection; from the perspective of the keyboard, it is control inversion, and the inserted keyboard controls what input device the computer is. The SSM framework is the integration of spring MVC, spring and mybatis frameworks. It is a standard MVC model that divides the entire system into four layers: presentation layer, controller layer, service layer, and DAO layer.

Why use dependency injection? The purpose is to be flexible. If the keyboard on your computer is welded to the computer, and the keyboard is broken, your computer is also useless. You certainly don't want this In Java development, we need to create a large number of objects. Some important objects affect the whole body. We can give Spring to help us create such objects. We only need to provide a configuration file. This configuration file can be xml or It can be java itself. For example, Spring is a factory, and products can be made according to drawings. What is the aspect of AOP? You can think of it like this: a company has multiple sales departments, and they all need administrative help to order stationery, air tickets, offices, business trips, hotels, etc. All need finance to handle reimbursement, receipts and payments, and warehouses to help deliver goods. What. It's impossible for every sales department to hire a few administrative, financial, and warehouse management. The sales department only needs to do a good job of doing business, and order stationery and other things to a special department.

For Spring MVC, you must first understand what MVC is? C-Controller: Controller. Accept the user's request, call the Model for processing, and then select the appropriate View to the client. M-Model: Model. The business processing model accepts dispatch from the Controller, processes business, and processes data. V-View: View. Return the result to the customer. Note that the customer here may not be a person, it may be a browser, or an APP. You must not understand this way, for example: you go to a restaurant to eat, and after sitting down, the waiter will come to you to order. You order a kung pao, and the waiter will take your order to the cook. The chef in the back kitchen opens the food storage cabinet, finds the kung pao, turns on the stove, puts off the oil, stir-fry, and puts on the plate. The waiter took the plate back to your table. Of course, if the waiter thinks you are handsome, you might secretly add a palace patron to you; if you happen to be the ex-boyfriend who dumped the waiter back then, maybe the waiter will spit in it. Here, you are the customer. When you order a dish, you send a request (Request), the waiter is the Controller, the back kitchen is the Model, the last plate and the contents of the waiter give you the View, and the waiter gives you the plate is the response (Respond).

Controller processes customer requests and feeds back to Model. The Model processes, and returns the data (Kung Pao Chicken) to the Controller (the waiter). The waiter can give it to you directly, or give it to you after adding chicken legs or spitting. In the end, you get a plate of food (View). Spring MVC is an MVC framework that is inherently integrated with Spring. MyBatis is a framework that helps you deal with the database. Help you translate database tables into classes, fields into class fields, and records into objects. (Of course you have to define these all by yourself.) The consequence of this is that you can manipulate the database like writing java. What to open JDBC to prevent sql injection, don't think about it, MyBatis will do it for you.

In Spring, the MyBatis framework can be integrated through simple settings, so there will be the SSM framework. Supplement If we regard the framework of SSM + some other functions as a desktop computer with a keyboard, mouse, monitor, USB flash drive, and audio plugged into the host... Then the Spring framework seems to be the host of the computer, and Spring MVC is similar to the display (Web interaction Beautiful, right?) MyBatis is like a hard disk (mobile hard disk, USB flash drive), and other functional frameworks such as the security framework Shiro are like a fingerprint login device. Are these things plugged into the host?

Many students like to use the SSM framework for design. From my personal experience, this is a good choice. Because it can set up the project relatively quickly, it can also be upgraded and maintained well in the later stage. But if it is difficult to complete the design based on SSM framework, or javaweb, and the design of WeChat applets? Let's talk about the steps below. Jia buckle. (One zero three two three seven one second one). We first choose the topic that suits you based on your knowledge. Because the topic is the most important. After choosing the topic, you need to prepare the opening report. If you have already written the opening question, then we will design according to your opening question. No matter what the topic is, it can be customized. It must be customized 100% on demand. It must be customized to include the functional modules and technical requirements you gave, not to sell finished products. Payment will be made after the acceptance is satisfied. We can discuss what we don’t understand later.

In Spring AOP, these public affairs, that is, administration, finance, and warehouse management in this example, are regarded as aspects, so that when you develop, you can focus on your core business. Let’s take an example of business: For example, if I transfer 100 yuan to you from Alipay, the normal operation should be 100 less in my account and 100 more in your account. If for various reasons, after I am less than 100, the system has a problem. If there is no business, your account will not be more than 100, while my account is less than 100. This is a problem. If there is a business: Either I will be less than 100 and you will be more than 100. Otherwise, it will not succeed, so that the money will not be less. Handwriting a transaction is still a bit difficult, Spring's transaction (spring-tx) can help us easily achieve it.

Guess you like

Origin blog.51cto.com/14992130/2547254