首先说明一下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,访问即可!
热门评论
喜欢就行过得刚收拾完