Springboot学习一 helloworld
来源:互联网 发布:mac如何删除管理员账户 编辑:程序博客网 时间:2024/05/16 19:20
SpringBoot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。通过这种方式,Boot致力于在蓬勃发展的快速应用开发领域(rapid application development)成为领导者。
1.建立maven项目,配置pom文件
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.study</groupId> <artifactId>helloworld</artifactId> <version>1.0-SNAPSHOT</version> <!--继承父的SpringBoot--> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.6.RELEASE</version> </parent> <!--增加web应用--> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies></project>
2.编写启动类
import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestController@EnableAutoConfigurationpublic class App { @RequestMapping("/") String home() { return "Hello World!"; } public static void main(String[] args){ SpringApplication.run(App.class,args); }}
@EnableAutoConfiguration注解是一个自动配置的类,@RestController是在@Controkker注解的基础上增加了@Responsebody注解,当然这两个注解也可以使用@SpringBootApplication
3.测试页面访问
http://localhost:8080/
阅读全文
0 0
- Springboot学习一 helloworld
- springboot学习笔记(一) HelloWorld
- SpringBoot学习笔记--HelloWorld
- SpringBoot学习——SpringBoot入门HelloWorld
- springboot学习-基本配置helloworld
- (1) 学习SpringBoot 之HelloWorld
- (1) 学习SpringBoot 之HelloWorld
- SpringBoot搭建微服务(一)HelloWorld!
- springboot入門(一) helloworld
- SpringBoot-HelloWorld
- SpringBoot HelloWorld
- SpringBoot HelloWorld
- Springboot-HelloWorld
- springboot---helloworld
- 【系统学习SpringBoot】SpringBoot新建HelloWorld工程(IDEA)
- JNI学习(一)----helloworld
- struts2 学习一 HelloWorld
- springboot学习笔记(一)
- P1162 填涂颜色
- 回调函数中调用类中的非静态成员变量或非静态成员函数
- 指针的学习(3)指针作为函数的参数的输入和输出的参数的特性
- [POJ] 2411 Mondriaan's Dream [轮廓线dp]
- PHP 报错 Warning: Unknown: failed to open stream Fatal error: Unknown: Failed opening required
- Springboot学习一 helloworld
- Windows远程桌面连接ubuntu 14.04设置教程
- Unity里用最简单的办法实现一个物体一直看另一个物体
- 新写的博客开始
- File复制
- 安装mysql-python时,报错 Python version 2.7 required, which was not found in the registry.
- Hive客户端调用的几种方式
- 总结一:神经网络训练过程中可能引起NaN的三种原因总结
- JAVA-初步认识-第二章-变量续