随着IDEA的出现,原来越多的JAVA程序员在使用IDEA,为了跟上时代的步伐,从鄙视链中向到上一级,学习IDEA的使用

新建springboot项目

IDEA的使用(1 springboot从无到hello world)

然后等待下载

IDEA的使用(1 springboot从无到hello world)

每次下载都很慢,很大概率会下载失败,不知道有没有什么好的建议,已经失败好多次了

IDEA的使用(1 springboot从无到hello world)

浏览器是可以访问 https://start.spring.io/ 的,

失败若干次之后,终于成功了

IDEA的使用(1 springboot从无到hello world)

项目 结构

IDEA的使用(1 springboot从无到hello world)

启动方法

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

   public static void main(String[] args) {
      SpringApplication.run(DemoApplication.class, args);
   }
}
新建一个helloworld 

package com.example.demo.web;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by shj on 2018/7/12.
 */

@RestController

public class HelloWorld {

    @RequestMapping("/hello")
    public  String index(){

        return  "hello world";
    }
}

终于见到hello world ,feel so good

IDEA的使用(1 springboot从无到hello world)








遇到的问题

IDEA 没有目录结构

IDEA的使用(1 springboot从无到hello world)

解决方案

file -> 项目结构 ->Modules

IDEA的使用(1 springboot从无到hello world)

IDEA的使用(1 springboot从无到hello world)

选择加号 import module

IDEA的使用(1 springboot从无到hello world)

找到当前项目-->确定

IDEA的使用(1 springboot从无到hello world)

选择maven

IDEA的使用(1 springboot从无到hello world)

选择root directory

IDEA的使用(1 springboot从无到hello world)

之后一直按照默认选项就好

IDEA的使用(1 springboot从无到hello world)

IDEA的使用(1 springboot从无到hello world)


pom.xml中的依赖包没有导入到项目中

 项目配置 facets 重新配置一遍

IDEA的使用(1 springboot从无到hello world)


Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Jul 12 10:01:30 CST 2018
There was an unexpected error (type=Not Found, status=404).
No message available

目录结构出错

IDEA的使用(1 springboot从无到hello world)

相关文章:

  • 2022-01-03
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
  • 2021-05-04
  • 2021-08-14
  • 2021-10-04
  • 2021-06-27
猜你喜欢
  • 2021-05-22
  • 2021-12-06
  • 2021-06-24
  • 2021-05-26
  • 2021-05-12
  • 2022-12-23
  • 2021-12-29
相关资源
相似解决方案