首先说明一下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.“
- 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,这样就可以启动项目了,直接http:localhost:8080,访问即可!
點擊查看更多內容
11人點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優質文章
正在加載中
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦