1.maven配置

<?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.example</groupId>
<artifactId>myproject</artifactId>
<version>0.0.1-SNAPSHOT</version> <!-- Inherit defaults from Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
</parent> <!-- Add typical dependencies for a web application -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<!-- Package as an executable jar -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

2.简单运行

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class GirlApplication {
public static void main(String[] args) {
//启动方式
SpringApplication.run(GirlApplication.class, args);
}
}
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; @RestController
public class HelloController {
@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String say() {
return "Hello Spring Boot!";
}
}

3.配置访问

配置文件application.properties指定访问端口和路径

server.port=8081
server.context-path=/girl

******

3.连接数据库属性文件配置

spring boot入门学习---1的更多相关文章

  1. Spring Boot入门学习

    1. Spring Boot概述 1.1.什么是Spring Boot SpringBoot是一个可使用Java构建微服务的微框架.是Spring框架及其社区对"约定优先于配置"理 ...

  2. Spring Boot入门学习必知道企业常用的Starter

    SpringBoot企业常用的 starter SpringBoot简介 SpringBoot运行 SpringBoot目录结构 整合JdbcTemplate @RestController 整合JS ...

  3. Spring Boot入门学习,解决复杂的spring配置文件及jar包

    转载:https://www.cnblogs.com/wmyskxz/p/9010832.html 总结 为何出了这样的框架? Spring Boot 是所有基于 Spring 开发的项目的起点.Sp ...

  4. spring boot入门学习---热部署

    1.maven文件 2.application.properties文件配置

  5. Spring boot学习1 构建微服务:Spring boot 入门篇

    Spring boot学习1 构建微服务:Spring boot 入门篇 Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框 ...

  6. Spring Boot入门(五):使用JDBC访问MySql数据库

    本系列博客记录自己学习Spring Boot的历程,如帮助到你,不胜荣幸,如有错误,欢迎指正! 在程序开发的过程中,操作数据库是必不可少的部分,前面几篇博客中,也一直未涉及到数据库的操作,本篇博客 就 ...

  7. Spring Boot入门(四):开发Web Api接口常用注解总结

    本系列博客记录自己学习Spring Boot的历程,如帮助到你,不胜荣幸,如有错误,欢迎指正! 在程序员的日常工作中,Web开发应该是占比很重的一部分,至少我工作以来,开发的系统基本都是Web端访问的 ...

  8. Spring Boot入门(六):使用MyBatis访问MySql数据库(注解方式)

    本系列博客记录自己学习Spring Boot的历程,如帮助到你,不胜荣幸,如有错误,欢迎指正! 本篇博客我们讲解下在Spring Boot中使用MyBatis访问MySql数据库的简单用法. 1.前期 ...

  9. Springboot 系列(一)Spring Boot 入门篇

    注意:本 Spring Boot 系列文章基于 Spring Boot 版本 v2.1.1.RELEASE 进行学习分析,版本不同可能会有细微差别. 前言 由于 J2EE 的开发变得笨重,繁多的配置, ...

随机推荐

  1. spring实例化二:SimpleInstantiationStrategy

            spring对类的实例化,定义了接口InstantiationStrategy,同时先做了个简单实现类SimpleInstantiationStrategy.采用实现部分,抽象部分的策 ...

  2. docker换源

    方案一 修改或新增 /etc/docker/daemon.json # vi /etc/docker/daemon.json { "registry-mirrors": [&quo ...

  3. 小程序setData数据量过大时候会对渲染有影响吗?

    datas:[ { id:1000, name: "帅哥", title: '...', b: '...', d: 0, f:0, .... }, { id:1001, name: ...

  4. 多git项目中账户的管理

    每个项目配置用户名: git config user.name "your_name" git config user.email "your_email" 如 ...

  5. Java8-Optional-No.02

    import java.util.Optional; import java.util.function.Supplier; public class Optional2 { static class ...

  6. 了解 Spring Boot

    Spring Boot是什么,解决哪些问题? SpringBoot是伴随着Spring4.0诞生的: 从字面理解,Boot是引导的意思,因此SpringBoot帮助开发者快速搭建Spring框架: S ...

  7. BZOJ 3925: [Zjoi2015] 地震后的幻想乡(概率DP)

    这里有一篇很好很强的博客%%% YouSiki大佬的博客 多理解一会就行了- 代码 #include <bits/stdc++.h> using namespace std; typede ...

  8. STS创建spring boot项目,pom.xml文件第一行报错

    亲测能用url地址:https://blog.csdn.net/jrx1995/article/details/100008552

  9. [Luogu] 程序自动分析

    题面:https://www.luogu.org/problemnew/show/P1955 题解:https://www.zybuluo.com/wsndy-xx/note/1143858

  10. P3979 遥远的国度 树剖

    P3979 遥远的国度 树剖 题面 需要想一下的树剖题,对于询问三需要处理换跟后的情况.我们以1为树根跑一遍剖分,对于换跟进行分类讨论,算出实际答案.讨论有三种情况: (以1为树根的树上) 跟在询问节 ...