基于SSM的后台管理系统(⼊门级DEMO,适合新⼿)
前⾔:
使⽤SpringMVC+Spring+Mybatis以及maven的后台管理系统,程序的结构分为表现层(Controller)、业务层(Service)、数据层(Dao),包括权限授权、分页查询、⽇志记录,订单及产品查询,授权管理等功能。⼊门级DEMO,具备后台管理系统的通⽤特征,以后可以在别的后台系统中直接拿来⽤
远程仓库地址:
⽬录
spring ioc注解
技术点:
1、Spring IOC & DI(控制反转和依赖注⼊)
2、Spring AOC (切⾯编程)
3、Spring Security 进⾏⽤户登录与注销等安全授权
4、Mybatis dao层半ORM数据库技术(单表查询、多表查询等)
5、Mybatis插件PageHelper,进⾏分页查询
6、⽅法级权限关联与控制(运⽤Sercurity标签等技术)
7、前端使⽤AdminLTE静态页⾯模板以及jquery等技术
说明:
1、SSM的配置还是⽐较繁琐的,不过作为⼊门级的DEMO,还是有必要⾃⼰亲⾃配的
2、Mybatis使⽤XML配置,DAO层由于想要提⾼SQL部分的解耦程度,所以使⽤XML配置统⼀管理
3、Service和Controller中由于不需要过多的配置、因此使⽤注解的⽅式进⾏依赖注⼊
运⾏结果:
先放两张图
项⽬结构图:
项⽬为多模块结构:domain为实体层
流程:
1、引⼊依赖⽂件(l)
这⾥没什么好说的,要⽤什么引⽤什么 。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="/POM/4.0.0"
xmlns:xsi="/2001/XMLSchema-instance"
xsi:schemaLocation="/POM/4.0.0 /xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>
<groupId>scau.zhong</groupId>
<artifactId>ssm_pratice</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<properties>
<!--版本锁定-->
<mybatis.version>3.5.1</mybatis.version>
<mysql.version>8.0.16</mysql.version>
<log4j.version>1.2.12</log4j.version>
<slf4j.version>1.6.6</slf4j.version>
<spring.version>5.1.7.RELEASE</spring.version>
<spring.security.version>5.0.1.RELEASE</spring.security.version>
</properties>
<dependencies>
<!--spring全家桶-->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<!--spring安全组件-->
<dependency>
<groupId>org.springframework.security</groupId>            <artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
<dependency>
<groupId>org.springframework.security</groupId>            <artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>            <artifactId>spring-security-core</artifactId>
<version>${spring.security.version}</version>
</dependency>
<!--权限控制_页⾯控制-->
<dependency>
<groupId>org.springframework.security</groupId>            <artifactId>spring-security-taglibs</artifactId>
<version>${spring.security.version}</version>
</dependency>
<!--测试-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!--mysql坐标-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!--mybatis-->
<dependency>
<groupId&batis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId&batis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.0</version>
</dependency>
<!--servlet API-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- log start -->
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- log end -->
<!--数据库连接池C3P0-->
<!-- mvnrepository/hange/c3p0 -->
<dependency>
<groupId&hange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.4</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!--分页插件-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>
<!--权限控制JSR250注解标签-->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<!--多模块项⽬-->
<modules>
<module>ssm_dao</module>
<module>ssm_service</module>
<module>ssm_domain</module>
<module>ssm_utils</module>
<module>ssm_web</module>
</modules>
</project>
2、配置与整合
SSM整合的关键是⽤Spirng去整合SpirngMVC以及Mybatis,所以整合的基本流程是这样的:
1、配置Spring
2、配置Mybatis
3、配置Spring mvc
4、整合Spring和Mybatis

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。