zoukankan      html  css  js  c++  java
  • 在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

  • 相关阅读:
    玩转web之javaScript(五)---js和jquery一些不可不知的方法(input篇)
    设计模式 外观模式 一键电影模式
    设计模式 适配器模式 以手机充电器为例
    高仿微信5.2.1主界面架构 包含消息通知
    Java进阶 创建和销毁对象
    sql语句中单引号嵌套问题
    Spark SQL UDF和UDAF示例
    Spark Parquet使用
    iptables只允许指定ip访问本机的指定端口
    Spark On YARN内存和CPU分配
  • 原文地址:https://www.cnblogs.com/zj68/p/13568234.html
Copyright © 2011-2022 走看看