资讯专栏INFORMATION COLUMN

从零开始搭建SSM框架(Spring + Spring MVC + Mybatis)

MiracleWong / 3375人阅读

摘要:打开,,选中,然后再选中,输入项目的和,指定等配置,修改,打开项目,添加一些必要的目录,最终项目框架目录图如下修改文件,指定各依赖和插件的版本等信息在标签里面管理各依赖的版本号添加项目依赖管理依赖配置好之后,开始整合。

最近在回顾和总结一些技术,想到了把之前比较火的 SSM 框架重新搭建出来,作为一个小结,同时也希望本文章写出来能对大家有一些帮助和启发,因本人水平有限,难免可能会有一些不对之处,欢迎各位大神拍砖指教,共同进步。

本文章示例使用 IntelliJ IDEA 来开发,JDK 使用 11 版本,其余各框架和技术基本上使用了文章撰写当时的最新版本。

好的,下面直接进入正题。

打开 IntelliJ IDEA,File > New > Project > Maven,选中“Create from archetype”,然后再选中“org.apache.maven.archetypes:maven-archetype-webapp”:

Next,输入项目的“GroupId”、“ArtifactId”和Version:

Next,指定“Maven home directory”等配置:

Next,修改Project Name:

Finish,打开项目,添加一些必要的目录,最终项目框架目录图如下:

修改pom.xml文件,指定各依赖和插件的版本等信息:


    UTF-8

    11
    11
    11

    5.1.6.RELEASE
    4.12

    1.18.6

    3.1.1
    2.3.28
    1.1.16
    2.0
    8.0.16

    1.2
    4.0.1
    2.3.3

    2.9.2

    3.9
    2.9.8
    1.3.0.Final

    2.11.2
    1.7.26

    3.1.0
    3.1.0
    3.8.0
    3.0.0-M3
    3.2.2
    3.0.0-M1
    3.0.0-M1

标签里面管理各依赖的版本号:


    
        
            org.springframework
            spring-context
            ${spring.version}
        
        
            org.springframework
            spring-context-support
            ${spring.version}
        
        
            org.springframework
            spring-beans
            ${spring.version}
        
        
            org.springframework
            spring-jdbc
            ${spring.version}
        
        
            org.springframework
            spring-aop
            ${spring.version}
        
        
            org.springframework
            spring-aspects
            ${spring.version}
        
        
            org.springframework
            spring-webmvc
            ${spring.version}
        
        
            org.springframework
            spring-test
            ${spring.version}
            test
        
        
            junit
            junit
            ${junit.version}
            test
        

        
            org.projectlombok
            lombok
            ${lombok.version}
            provided
        

        
            com.baomidou
            mybatis-plus
            ${mybatis-plus.version}
        
        
            com.baomidou
            mybatis-plus-generator
            ${mybatis-plus.version}
            test
            true
        
        
            org.freemarker
            freemarker
            ${freemarker.version}
            test
            true
        
        
            com.alibaba
            druid
            ${druid.version}
        
        
            com.github.jsqlparser
            jsqlparser
            ${jsqlparser.version}
        
        
            mysql
            mysql-connector-java
            ${mysql-connector.version}
        

        
            javax.servlet.jsp.jstl
            jstl-api
            ${jstl-api.version}
        
        
            javax.servlet
            javax.servlet-api
            ${servlet-api.version}
            provided
        
        
            javax.servlet.jsp
            javax.servlet.jsp-api
            ${jsp-api.version}
            provided
        

        
            io.springfox
            springfox-swagger2
            ${springfox-swagger.version}
        
        
            io.springfox
            springfox-swagger-ui
            ${springfox-swagger.version}
        

        
            org.apache.commons
            commons-lang3
            ${commons-lang3.version}
        
        
            com.fasterxml.jackson.core
            jackson-databind
            ${jackson.version}
        
        
            com.fasterxml.jackson.core
            jackson-annotations
            ${jackson.version}
            compile
        
        
            org.mapstruct
            mapstruct
            ${mapstruct.version}
        

        
            org.slf4j
            slf4j-api
            ${slf4j.version}
        
        
            org.apache.logging.log4j
            log4j-slf4j-impl
            ${log4j.version}
        
    

添加项目依赖:


    
        org.springframework
        spring-context-support
    
    
        org.springframework
        spring-jdbc
    
    
        org.springframework
        spring-aspects
    
    
        org.springframework
        spring-webmvc
    
    
        org.springframework
        spring-test
    
    
        junit
        junit
    

    
        org.projectlombok
        lombok
    

    
        com.baomidou
        mybatis-plus
    
    
        com.baomidou
        mybatis-plus-generator
    
    
        org.freemarker
        freemarker
    
    
        com.alibaba
        druid
    
    
        mysql
        mysql-connector-java
    

    
        javax.servlet.jsp.jstl
        jstl-api
    
    
        javax.servlet
        javax.servlet-api
    
    
        javax.servlet.jsp
        javax.servlet.jsp-api
    

    
        io.springfox
        springfox-swagger2
    
    
        io.springfox
        springfox-swagger-ui
    

    
        org.apache.commons
        commons-lang3
    
    
        com.fasterxml.jackson.core
        jackson-databind
    
    
        org.mapstruct
        mapstruct
    

    
        org.apache.logging.log4j
        log4j-slf4j-impl
    

管理


    ssm
    
        
            
                org.apache.maven.plugins
                maven-clean-plugin
                ${clean.plugin.version}
            
            
                org.apache.maven.plugins
                maven-resources-plugin
                ${resources.plugin.version}
                
                    ${project.build.sourceEncoding}
                
            
            
                org.apache.maven.plugins
                maven-compiler-plugin
                ${compiler.plugin.version}
                
                    ${maven.compiler.source}
                    ${maven.compiler.target}
                    ${project.build.sourceEncoding}
                    
                        
                            org.projectlombok
                            lombok
                            ${lombok.version}
                        
                        
                            org.mapstruct
                            mapstruct-processor
                            ${mapstruct.version}
                        
                    
                    
                        -Amapstruct.defaultComponentModel=spring
                        -Amapstruct.unmappedTargetPolicy=IGNORE
                    
                
            
            
                org.apache.maven.plugins
                maven-surefire-plugin
                ${surefire.plugin.version}
            
            
                org.apache.maven.plugins
                maven-war-plugin
                ${war.plugin.version}
            
            
                org.apache.maven.plugins
                maven-install-plugin
                ${install.plugin.version}
            
            
                org.apache.maven.plugins
                maven-deploy-plugin
                ${deploy.plugin.version}
            
        
    

依赖配置好之后,开始整合。

先整合Log4j2日志,在项目classpath目录(src/main/resources)下创建log4j2.xml文件,添加Log4j2日志配置:



    
        
            
        
    
    
        
            
        
    

再整合 Spring 和 Mybatis,本次还整合了 Mybatis Plus 开源框架,新建 src/main/resources/mybatis/mybatis-config.xml 文件:




    
        
        
        
        
        
        
    
    
    
        
    

新建 src/main/resources/properties/jdbc.properties 文件,配置数据源连接信息:

jdbc.driverClassName=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/ssm?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2B8
jdbc.username=root
jdbc.password=root

新建 src/main/resources/spring/applicationContext-dao.xml 文件,配置 Druid 数据源,SqlSessionFactory 会话工厂,Mybatis 的 Mapper 接口扫描等信息:




    

    
    
    
        
            
                com.example.ssm.service.*
                com.example.ssm.mapper.*
            
        
    
    
        
    

    
    
        
        
        
    

    
    
        
    

    
    
        
        
        
    

    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
            
                
                
                
            
        
        
    

    
    
        
        
        
        
        
            
                
                
                
                
            
        
    

    
    
        
        
    

新建 src/main/resources/spring/applicationContext-tx.xml 文件,配置事务:




    

    
    
        
    

    

配置 Mybatis Plus 自动生成 Controller、Service 和 Mapper 文件:

// 自动代码生成器
AutoGenerator autoGenerator = new AutoGenerator();

// 全局配置
GlobalConfig globalConfig = new GlobalConfig();
String projectPath = System.getProperty("user.dir");
globalConfig.setOutputDir(projectPath + "/src/main/java");
globalConfig.setAuthor("calvinit");
globalConfig.setOpen(false);
globalConfig.setFileOverride(true);
// Druid 1.1.16 版本貌似不支持 java8 新的时间类型,如 java.time.LocalDateTime
globalConfig.setDateType(DateType.ONLY_DATE);

autoGenerator.setGlobalConfig(globalConfig);

// 数据源配置
DataSourceConfig dataSourceConfig = new DataSourceConfig();
dataSourceConfig.setDbType(DbType.MYSQL);
dataSourceConfig.setUrl("jdbc:mysql://127.0.0.1:3306/ssm?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2B8");
// dataSourceConfig.setSchemaName("public");
dataSourceConfig.setDriverName("com.mysql.cj.jdbc.Driver");
dataSourceConfig.setUsername("root");
dataSourceConfig.setPassword("root");

autoGenerator.setDataSource(dataSourceConfig);

// 包配置
PackageConfig packageConfig = new PackageConfig();
packageConfig.setParent("com.example.ssm");

autoGenerator.setPackageInfo(packageConfig);

// 自定义配置
InjectionConfig injectionConfig = new InjectionConfig() {
    @Override
    public void initMap() {
        // to do nothing
    }
};

// 如果模板引擎是 freemarker
String templatePath = "/templates/mapper.xml.ftl";

// 自定义输出配置
List focList = new ArrayList<>();
// 自定义配置会被优先输出
focList.add(new FileOutConfig(templatePath) {
    @Override
    public String outputFile(TableInfo tableInfo) {
        tableInfo.setImportPackages("com.baomidou.mybatisplus.annotation.TableName");
        tableInfo.setConvert(true);
        // 自定义输出文件名
        return projectPath + "/src/main/resources/mapper/"
                + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
    }
});

injectionConfig.setFileOutConfigList(focList);

autoGenerator.setCfg(injectionConfig);

// 配置模板
TemplateConfig templateConfig = new TemplateConfig();

// 配置自定义输出模板
// templateConfig.setEntity(ConstVal.TEMPLATE_ENTITY_JAVA);
// templateConfig.setService(ConstVal.TEMPLATE_SERVICE);
// templateConfig.setController(ConstVal.TEMPLATE_CONTROLLER);
templateConfig.setXml(null);

autoGenerator.setTemplate(templateConfig);

// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
// strategy.setSuperEntityClass("com.example.ssm.entity.BaseEntity");
strategy.setEntityLombokModel(true);
strategy.setEntityColumnConstant(true);
strategy.setRestControllerStyle(true);
// strategy.setSuperControllerClass("com.example.ssm.controller.BaseController");
strategy.setInclude("t_user", "t_group", "t_user_group_relation");
// strategy.setSuperEntityColumns("id");
strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix(packageConfig.getModuleName() + "_");
strategy.setEntityTableFieldAnnotationEnable(true);

autoGenerator.setStrategy(strategy);
autoGenerator.setTemplateEngine(new FreemarkerTemplateEngine());
autoGenerator.execute();

然后整合 Spring 和 Spring MVC,其中对日期类型返回json作了自定义格式化处理:

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * Jackson ObjectMapper 工厂类
 */
public class ObjectMapperFactory {

    public static ObjectMapper getMapper() {
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));

        SimpleModule module = new SimpleModule();
        module.addSerializer(LocalDate.class, new LocalDateSerializer());
        module.addSerializer(LocalTime.class, new LocalTimeSerializer());
        module.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer());

        objectMapper.registerModule(module);

        return objectMapper;
    }

    static class LocalDateSerializer extends JsonSerializer {

        private static final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");

        /**
         * {@inheritDoc}
         */
        @Override
        public void serialize(LocalDate value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
            jgen.writeString(dateFormatter.format(value));
        }
    }

    static class LocalDateTimeSerializer extends JsonSerializer {

        private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

        /**
         * {@inheritDoc}
         */
        @Override
        public void serialize(LocalDateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
            jgen.writeString(dateTimeFormatter.format(value));
        }

    }

    static class LocalTimeSerializer extends JsonSerializer {

        private static final DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");

        /**
         * {@inheritDoc}
         */
        @Override
        public void serialize(LocalTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
            jgen.writeString(timeFormatter.format(value));
        }
    }
}

还集成了 Swgger UI ,方便接口调试:

import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableSwagger2
public class Swagger2Configuration {

    @Bean("docket")
    public Docket createDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.ssm.controller"))
                .paths(PathSelectors.any())
                .build()
                .apiInfo(apiInfo());
    }

    private ApiInfo apiInfo() {
        Contact contact = new Contact("calvinit", "https://gitee.com/calvinit/ssm-demo", "");
        return new ApiInfoBuilder()
                .title("SSM框架搭建Demo")
                .description("SSM框架搭建Demo,仅供猿友们学习交流之用,请勿用于商业用途")
                .contact(contact)
                .version("1.0-SNAPSHOT")
                .build();
    }
}

新建 src/main/resources/spring/spring-mvc.xml 文件:




    

    

    
    

    
        
            
                
                
                    
                        application/json;charset=UTF-8
                    
                
            
            
                
            
        
    

    
        
        
    

    
    
    
    

同时整合了MapStruct,方便 Entity、DTO 和 VO 等之间的转换,使用示例:

import com.example.ssm.entity.User;
import com.example.ssm.vo.UserVo;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper
public interface UserVoConverter {

    @Mappings({
            @Mapping(source = "id", target = "userId"),
            @Mapping(source = "name", target = "userName"),
            @Mapping(target = "createDt", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(target = "lastUpdateDt", dateFormat = "yyyy-MM-dd HH:mm:ss")
    })
    UserVo entityToVo(User user);

    List batchEntityToVo(List userList);

    @InheritInverseConfiguration
    User voToEntity(UserVo userVo);

    List batchVoToEntity(List userVoList);
}

新建 src/main/resources/spring/applicationContext-common.xml 文件,配置 MapStruct 的 bean 被 Spring 管理:




    

修改 web.xml 文件:




    ssm

    
    
        contextConfigLocation
        classpath:spring/applicationContext-*.xml
    
    
    
        log4jConfigLocation
        classpath:log4j2.xml
    

    
    
        characterEncodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
    
    
        characterEncodingFilter
        /*
    

    
    
        druidWebStatFilter
        com.alibaba.druid.support.http.WebStatFilter
        
            exclusions
            *.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
        
        
            profileEnable
            true
        
    
    
        druidWebStatFilter
        /*
    

    
        org.springframework.web.context.ContextLoaderListener
    

    
    
        dispatcherServlet
        org.springframework.web.servlet.DispatcherServlet
        
            contextConfigLocation
            classpath:spring/spring-mvc.xml
        
        1
    
    
        dispatcherServlet
        /
    

    
    
        druidStatView
        com.alibaba.druid.support.http.StatViewServlet
        
            
            allow
            127.0.0.1
        
        
            
            loginUsername
            user
        
        
            
            loginPassword
            password
        
        
            
            resetEnable
            true
        
    
    
        druidStatView
        /druid/*
    

    
        index.jsp
    

修改 index.jsp 文件:

<%@ page contentType="text/html;charset=UTF-8" %>


    ssm


Hello World!

打开 Swagger UI

至此,框架基本整合完毕,下面写一个测试 Contoller 测试 Spring 和 Spring MVC 整合结果:

package com.example.ssm.controller;

import com.google.common.collect.Maps;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

@Api(tags = "首页控制器")
@Controller
@RequestMapping
public class IndexController {

    @ApiIgnore
    @ApiOperation(value = "首页")
    @GetMapping
    public String index() {
        return "index";
    }

    @ApiOperation(value = "返回纯字符串")
    @GetMapping("/hello")
    @ResponseBody
    public String hello() {
        return "Hello World!";
    }

    @ApiOperation(value = "测试日期 json 返回")
    @GetMapping("/date/test")
    @ResponseBody
    public Map testDate() {
        Map map = Maps.newHashMap();

        map.put("java.util.Date", new java.util.Date());
        map.put("java.sql.Date", new java.sql.Date(System.currentTimeMillis()));
        map.put("java.time.LocalDate", java.time.LocalDate.now());
        map.put("java.time.LocalTime", java.time.LocalTime.now());
        map.put("java.time.LocalDateTime", java.time.LocalDateTime.now());

        return map;
    }
}

右上角“Add Configuration”添加 Tomcat 配置,将项目部署信息配置好:

然后我们启动 Tomcat,打开 http://localhost:8080/ssm,如果正常,应该显示如下界面:

点击界面上的超链接,进入 Swagger UI 的界面。

再测试一下 Spring 和 Mybatis 整合是否完成:

package com.example.ssm.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.ssm.converter.UserVoConverter;
import com.example.ssm.entity.User;
import com.example.ssm.service.IUserService;
import com.example.ssm.vo.PageVo;
import com.example.ssm.vo.UserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.NonNull;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api
@RestController
@RequestMapping("/users")
public class UserController {

    private IUserService userService;
    private UserVoConverter userVoConverter;

    @Autowired
    public UserController(@NonNull IUserService userService, @NonNull UserVoConverter userVoConverter) {
        this.userService = userService;
        this.userVoConverter = userVoConverter;
    }

    @ApiOperation(value = "分页查询用户列表")
    @GetMapping("/page")
    @ResponseBody
    public PageVo page(
            @ApiParam(value = "当前页", required = true, defaultValue = "1", example = "1")
            @RequestParam("pageNum") int pageNum,
            @ApiParam(value = "页面大小", required = true, defaultValue = "10", example = "10")
            @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {

        Page page = new Page<>();
        page.setSize(pageSize);
        page.setCurrent(pageNum);
        page.setAsc(User.CREATE_DT, User.LAST_UPDATE_DT);

        IPage userPage = userService.selectPage(page);
        List userList = userPage.getRecords();
        List userVoList = userVoConverter.batchEntityToVo(userList);

        return new PageVo()
                .setPageNum(userPage.getCurrent())
                .setPageSize(userPage.getSize())
                .setPageTotal(userPage.getPages())
                .setRowTotal(userPage.getTotal())
                .setRowList(userVoList)
                .get();
    }

    @ApiOperation(value = "查询某个用户")
    @GetMapping("/{id}")
    @ResponseBody
    public User page(
            @ApiParam(value = "用户Id", required = true, example = "1")
            @PathVariable(value = "id") int id) {

        return userService.selectByPrimaryKey(id);
    }

    @ApiOperation(value = "获取所有00后用户列表")
    @GetMapping("/00/list")
    @ResponseBody
    public List list00() {
        LambdaQueryWrapper userLambdaQueryWrapper = Wrappers.lambdaQuery();
        userLambdaQueryWrapper.ge(User::getBirthday, "2000-01-01");

        return userService.list(userLambdaQueryWrapper);
    }
}

在 Swagger UI 的界面里面测试接口,返回正确:

另外,Druid 的监控信息页面链接为:http://localhost:8080/ssm/druid/index.html,访问白名单、账号和密码在 web.xml 文件中配置。

至此,SSM 框架集成完毕,测试通过!

因篇幅关系,一些代码并没有在此文章中展现,可到我的Gitee上看完整框架代码。

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/74383.html

相关文章

  • Java后端

    摘要:,面向切面编程,中最主要的是用于事务方面的使用。目标达成后还会有去构建微服务,希望大家多多支持。原文地址手把手教程优雅的应用四手把手实现后端搭建第四期 SpringMVC 干货系列:从零搭建 SpringMVC+mybatis(四):Spring 两大核心之 AOP 学习 | 掘金技术征文 原本地址:SpringMVC 干货系列:从零搭建 SpringMVC+mybatis(四):Sp...

    joyvw 评论0 收藏0
  • SSM框架网站后台搭建(一)

    摘要:传统的代码中,在类中调用其他对象,都是自己出来一个对象,然后调用,这样代码的耦合度就比较高。日志对象和主程序的耦合度降到最低,即使更改日志对象的操作,主程序不受影响。 SSM框架网站后台搭建(一) 1.所用技术简单介绍 1.SSM中的S:Spring Spring在百度词条上的解释是: Spring是一个开放源代码的设计层面框架,他解决的是业务逻辑层和其他各层的松耦合问题,因此它将面向...

    ZweiZhao 评论0 收藏0
  • SSM框架运行机制

    摘要:框架搭建首先下载相应的包,对于包有两种方式使用创建依赖从而导入所需的包。总结主要进行页面的请求接受与响应。组件包括前端控制器,处理器映射器,处理器适配器,视图解析器,处理器,视图。 我之前的文章介绍了如何搭建SSH框架以及如何利用这一框架来进行web应用开发,最近我又接触了SSM框架即Spring+SpringMVC+Mybatis三大框架的整合,而且目前该框架就SSH框架而言使用的较...

    winterdawn 评论0 收藏0
  • SSM框架运行机制

    摘要:框架搭建首先下载相应的包,对于包有两种方式使用创建依赖从而导入所需的包。总结主要进行页面的请求接受与响应。组件包括前端控制器,处理器映射器,处理器适配器,视图解析器,处理器,视图。 我之前的文章介绍了如何搭建SSH框架以及如何利用这一框架来进行web应用开发,最近我又接触了SSM框架即Spring+SpringMVC+Mybatis三大框架的整合,而且目前该框架就SSH框架而言使用的较...

    Batkid 评论0 收藏0
  • 【Java】基于Maven搭建Spring+SpringMVC+Mybatis框架

    摘要:关于的配置,可以参考这篇文章的第一个小节配置模板引擎搭什么搭直接用脚手架不行吗下载就能用下载就能用下载就能用码云咳咳,开个玩笑,如果本着学习态度的话,那就慢慢啃吧搭建空的项目使用搭建基本的空项目填写和,,选择项目的地址,在新的窗口打开最 关于springMVC的配置,可以参考这篇文章的第一个小节:【java】intellij idea SpringMVC 配置FreeMarker模板引...

    edagarli 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<