springBoot快速搭建啟動專案

歐陽慍斐發表於2018-06-27

首先說明一下springboot是什麼吧!spriangboot是spring獨立出來的專案,用於快速搭建服務專案。引用springBoot自己的話:‘’Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”. We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.“

  1. springboot地址:http://projects.spring.io/spring-boot/
    2、需要下載相應依賴包;
    廢話不多說,上demo

“`@SpringBootApplication
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
@ImportResource({“classpath:/applicationContext.xml”})
public class Application extends SpringBootServletInitializer{
@RequestMapping(“/”)
String home() {
return “Hello World!”;
}

@RequestMapping("/now")
String hehe() {
    return "現在時間:" + (new Date().toLocaleString());
}

public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
    System.out.println(2);
}

ok,這樣就可以啟動專案了,直接httplocalhost8080,訪問即可!

歡迎工作一到五年的Java工程師朋友們加入Java架構開發:468947140

點選連結加入群聊【Java-BATJ企業級資深架構】:https://jq.qq.com/?_wv=1027&k=5zMN6JB

本群提供免費的學習指導 架構資料 以及免費的解答

不懂得問題都可以在本群提出來 之後還會有職業生涯規劃以及面試指導


相關文章