首先说明一下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人点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦