首先说明一下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.“
```@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,访问即可!
2025 - 快车库 - 我的知识库 重庆启连科技有限公司 渝ICP备16002641号-10
企客连连 表单助手 企服开发 榜单123