spring boot gradle 学习笔记(1)
来源:互联网 发布:java 系统当前时间 编辑:程序博客网 时间:2024/06/08 16:04
1、编码环境:jdk版本1.8、intellij idea版本2016.2.5、gradle版本3.2
2、新建项目
项目的build.gralde配置如下:
group 'org.changs'version '1.0-SNAPSHOT'apply plugin: 'java'sourceCompatibility = 1.8repositories { mavenCentral() jcenter()}dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' compile("org.springframework.boot:spring-boot-starter-web:1.4.3.RELEASE") testCompile("org.springframework.boot:spring-boot-starter-test:1.4.3.RELEASE")}
3、添加Application入口函数
package org.changs.learn;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;import org.springframework.context.annotation.ComponentScan;import org.springframework.context.annotation.Configuration;@Configuration@EnableAutoConfiguration//自动扫描该包下的所有包、类@ComponentScan//自动扫描加载@Configuration注解的配置类public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); }}
4、添加示例接口:
package org.changs.learn.web;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;/** * Created by yincs on 2017/1/9. */@RestControllerpublic class HelloController { @RequestMapping("hello") public String hello() { return "hello spring-boot"; }}
5、运行Application类的main函数,启动成功后用浏览器访问http://localhost:8080/hello。页面上出现hello spring-boot!
ok!初步搭建已完成。
0 0
- spring boot gradle 学习笔记(1)
- Spring-boot 学习笔记(1)
- spring boot 学习笔记(1)
- spring-boot 学习笔记(1)
- Spring Boot学习笔记-1
- spring-boot学习笔记1
- Spring Boot学习(1)—— mac上Intellij使用Gradle构建Spring Boot项目,并使用Groovy
- spring-boot学习笔记
- Spring Boot学习笔记
- Spring Boot学习笔记
- spring boot 学习笔记
- Spring Boot学习笔记
- Spring Boot学习笔记
- Spring Boot 学习笔记
- spring boot学习笔记
- Spring Boot 学习笔记
- Spring Boot 学习笔记(-)
- Spring Boot 学习笔记
- 框架 day84 涛涛商城项目-订单系统,系统架构梳理及nginx实现虚拟主机
- eclipse配置tomcat
- api-ms-win-crt-runtime-l1-1-0.dll 下载
- 详解利用EXPLAIN分析sql语句的性能
- [设计模式]策略模式
- spring boot gradle 学习笔记(1)
- matplotlib的二维数据显示
- Makefile(14)
- python网络分析-数据集汇总
- 14 线性表 (9)
- C#字符串和值转换 以及万能转换
- android mvc 模式
- 一条热毛巾的10个神奇功效
- eclipse 添加 web 和 tomcat 插件