• 在idea上使用springboot构建ssm项目(一)


    springboot

    一、配置Maven

    1、Configure>Settings

    2、Build,Execution,Deployment>Build Tools>Maven>Maven home directory

    二、使用Maven方式构建

    1、点击Create New Project

     2、选择Maven,点击Next

    3、填写域名GroupId和ArtifactId,点击Next

    4、点击Finish

    5、配置pom.xml

        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.0.8.RELEASE</version>
        </parent>
    
        <dependencies>
            <!--引入springmvc web模块-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
        </dependencies>
    
        <build>
            <plugins>
                <!--加入打包依赖-->
                <!--<plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>-->
            </plugins>
        </build>
    

      

    6、Controller

    TestController.java

    package com.zj.controller;
    
    import org.springframework.web.bind.annotation.RestController;
    import org.springframework.web.bind.annotation.RequestMapping;
    
    @RestController
    public class TestController {
    
        @RequestMapping("/hello")
        public String testHello() {
            return "hello";
        }
    }
    

    7、application.properties文件可以改变配置属性

    server.port=8888
    

    8、启动类

    MainClassStart.java文件

    package com.zj;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    @SpringBootApplication
    public class MainClassStart {
        public static void main(String[] args) {
            SpringApplication.run(MainClassStart.class,args);
        }
    }
    

      

    9、使用启动类main方法启动

    10、输入网址

    localhost:8888/hello

    11、pom.xml支持jar

    链接:https://pan.baidu.com/s/1USffaVIrZIr_BxVV93TRTA
    提取码:8888

  • 相关阅读:
    Sokect简单入门(1)TCP协议一
    Tomcat内存溢出 解决方法
    服务器配置 ssl 证书,Nginx配置
    优秀的博客文章记录
    SpringBoot实现优雅的关机
    关于 redis 的 数据类型 和 内存模型
    微信, qq 支付宝 等相关开发 资源 记录
    设计模式 之 单列设计模式
    Swagger
    MQ服务器奔溃解决过程
  • 原文地址:https://www.cnblogs.com/zj68/p/13568234.html
Copyright © 2020-2023  润新知