SSM项目转Springboot项目

SSM项目转Springboot项目

由于几年前写的一个ssm项目想转成springboot项目,所以今天倒腾了一下。
最近有人需要毕业设计转换一下,所以我有时间的话可以有偿帮忙转换,需要的私信我或+v:Arousala_

首先创建一个新的springboot的工程,然后复制一下相关的依赖


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>
    <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.6.6version>
        <relativePath/> 
    parent>
    <groupId>com.dhnsoftgroupId>
    <artifactId>demoartifactId>
    <version>0.0.1-SNAPSHOTversion>
    <name>OnlineMallname>
    <description>Demo project for Spring Bootdescription>
    <properties>
        <java.version>1.8java.version>
    properties>
    <dependencies>

        
        <dependency>
            <groupId>org.apache.logging.log4jgroupId>
            <artifactId>log4j-coreartifactId>
            <version>2.17.1version>
        dependency>
        <dependency>
            <groupId>org.mybatisgroupId>
            <artifactId>mybatis-springartifactId>
            <version>2.0.6version>
        dependency>
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-txartifactId>
            <version>5.3.8version>
        dependency>
		
        <dependency>
            <groupId>javax.servlet.jsp.jstlgroupId>
            <artifactId>jstl-apiartifactId>
            <version>1.2version>
            <exclusions>
                <exclusion>
                    <groupId>javax.servletgroupId>
                    <artifactId>servlet-apiartifactId>
                exclusion>
                <exclusion>
                    <groupId>javax.servlet.jspgroupId>
                    <artifactId>jsp-apiartifactId>
                exclusion>
            exclusions>
        dependency>
        
        <dependency>
            <groupId>javax.servletgroupId>
            <artifactId>javax.servlet-apiartifactId>
        dependency>
        <dependency>
            <groupId>javax.servletgroupId>
            <artifactId>jstlartifactId>
        dependency>
        
        <dependency>
            <groupId>org.apache.tomcat.embedgroupId>
            <artifactId>tomcat-embed-jasperartifactId>
        dependency>



    dependencies>
    <build>
        <resources>
        	
            <resource>
                
                <directory>src/main/javadirectory>
                
                <includes>
                    <include>**/*.xmlinclude>
                includes>
            resource>
        resources>
        <plugins>
            <plugin>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-boot-maven-pluginartifactId>
            plugin>
            
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-jar-pluginartifactId>
            plugin>
        plugins>
    build>

project>

复制webapp在main和resources目录中,可以删除webapp中的web.xml,配置自行添加到启动类中

SSM项目转Springboot项目_第1张图片

在启动类中写好注解

package com.dhnsoft;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@MapperScan("com.dhnsoft.mapper")
@ServletComponentScan(basePackages = "com.dhnsoft.code")
public class OnlineMallApplication {

    public static void main(String[] args) {
        SpringApplication.run(OnlineMallApplication.class, args);
    }
}

还有一个错误如下

SSM项目转Springboot项目_第2张图片

加上文件前缀即可

SSM项目转Springboot项目_第3张图片

你可能感兴趣的:(java,spring,springboot)