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

6 篇文章 0 订阅
4 篇文章 0 订阅

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

新建springboot项目

然后等待下载

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

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

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

项目 结构

启动方法

 

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 没有目录结构

解决方案

file -> 项目结构 ->Modules

选择加号 import module

找到当前项目-->确定

选择maven

选择root directory

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

 

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

 项目配置 facets 重新配置一遍

 

 

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

目录结构出错

也可以通过配置 basePackages,解决找不到路径的问题

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Hero_孙

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值