Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction of ssm Framework

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article focuses on "introduction to the ssm framework". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the introduction of the ssm framework.

SSM framework is a collection of several open source frameworks integrated. It is a configuration scheme designed to facilitate our java development. SSM framework mainly uses spring + mybatis + springmvc. Of course, the mybatis in this can be converted into Hibernate, which is known as the SSH framework, and springmvc can also use struts2. But why design it this way?

1.spring: this is a key tool developed by java. Its IOC container can help us initialize objects, so we only need autowired when we use it, instead of going through new, and there are aop functions that can help us manage transactions.

2.springmvc: it's not really a framework, it's a tool for spring. It acts on the web layer, which is equivalent to controller, and is used to receive and process user requests. It can intercept requests sent by users, and then transmit the parameters of the request to controller, so that controller can handle the request, control page jump, call query methods in dao (actually called service layer), respond to user requests and a series of operations.

2.mybatis: this framework can help us manage sql, let us use xml configuration files to help us separate sql statements from the logical code of java, which makes it easy for us to read and write code and maintain code. Of course, this piece of content can be replaced by Hibernate.

Ok, who talks a lot of nonsense, is mainly talking about one thing, why integrate these frameworks. Let's start to prepare for integration. First, prepare the jar package needed for ssm. If you are a maven project, you do not need to download the following package, just introduce spring webmvc,spring jdbc,spring aspect,mybatis,mybatis-spring,mysql,c3p0,servlet-api,spring test,junit... into the tag in the pom.xml file. Copy the coordinates of the package directly from the maven repository. If you do not use the project, you can only download the necessary packages:

Spring: https://repo.spring.io/release/org/springframework/spring/ is the download address of spring. Although there are various versions, it is not recommended to use an overly high version, because some jar packages are not compatible with the high version of spring. I use 4.1.9.release. Of course, the contents of this package can be downloaded in the maven repository, but there are too many contents in the package, so it is better to download the zip file directly.

Other content can be downloaded from the maven repository:

Section-oriented AOP:aopaliance,aspectjrt,aspectjweaver

Log package on which spring depends: commons.logging,log4j

C3p0 connection Pool: c3p0Magi MchangeMutual java (versions after c3p0-0.9.1 need to add this package, otherwise an error will be reported)

Mysql driver: mysql-connector

Mybatis and mybatis and spring integrated package: mybatis,mybatis-spring

There are also some assistive tools, but some packages that are commonly used in development:

Pagehelper (paging plug-in), Jackson Databind (convert the request result to JSON format), jstl. Other packages can be added if they are in use.

At this point, I believe you have a deeper understanding of the "introduction to the ssm framework". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report