简述下java环境

1.安装jdk

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2.安装eclipse

https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/neon/3/eclipse-jee-neon-3-win32-x86_64.zip

3.新建一个maven项目

file-->new-->project-->maven project

4.根据springboot官网的配置配pom.xml

http://projects.spring.io/spring-boot/

需要注意的是 spring boot 1.5.2的最新版会有maven关联包引入问题

请使用1.5.1

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.1.RELEASE</version>
</parent>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

5.新建java类

package hello;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;

@Controller
@EnableAutoConfiguration
public class SampleController {

    @RequestMapping("/")
    @ResponseBody
    String home() {
        return "Hello World!";
    }

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

 

相关文章:

  • 2021-07-04
  • 2022-12-23
  • 2021-10-25
  • 2022-12-23
  • 2021-04-08
  • 2021-12-30
  • 2021-08-11
  • 2022-01-16
猜你喜欢
  • 2021-08-29
  • 2022-12-23
  • 2021-05-24
  • 2021-09-05
  • 2021-07-18
  • 2021-05-06
  • 2021-08-14
相关资源
相似解决方案