首页 > 其他分享 >【spring-boot】配置基础目录与启动

【spring-boot】配置基础目录与启动

时间:2022-12-30 15:45:09浏览次数:36  
标签:spring boot springframework public org import 目录

# POM.XML

<!--继承父项目spring-boot-starter-parent的依赖管理--> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.5.6</version> </parent> <!--导入web配置 启动器--> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>

 

# 创建启动主程序类   :: mainApplication   启动项目直接启动这个主程序

import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; // 主程序 @SpringBootApplication public class mainApplication { public static void main(String[] args) { SpringApplication.run(mainApplication.class,args); } }

 

# 第一个接口  

package start.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class helloSpring {

    @RequestMapping("/hello")
    public String helloworld(){
        return "hello springboot";
    }

}

 

标签:spring,boot,springframework,public,org,import,目录
From: https://www.cnblogs.com/wanghong1994/p/17015031.html

相关文章

  • SpringBoot参数校验
    原文:https://juejin.cn/post/6856541106626363399简单使用JavaAPI规范(JSR303)定义了Bean校验的标准validation-api,但没有提供实现。hibernatevalidation是对这个规范的......
  • 银河麒麟V10检查重要目录或文件/etc/rc0,d权限设置
    银河麒麟V10检查重要目录或文件权限设置,/etc/rc0.d/、/etc/rc1.d、/etc/rc2.d、/etc/rc3.d、/etc/rc4.d、/etc/rc5.d、/etc/rc6.d、/etc/rc.d/init.d/、这些目录跟系统启动......
  • SpringBoot - 异步任务 @EnableAsync,@Async
    1.在启动类上添加@EnabnleAsync注解开启对异步任务的支持//开启对异步任务的支持@EnableAsync@SpringBootApplicationpublicclassLearn20221218Application{p......
  • Spring MVC的web.xml配置详解
    SpringMVC是创建javaweb项目时比较常用的框架,其中web.xml配置文件是更不可少的,那么首先先了解javaweb中的web.xml文件。一、认识web.xml文件1、web.xml的作用首先java......
  • springboot HandlerIntercept
    1、新建上下文类工具类publicclassContextHolder{privatestaticfinalInheritableThreadLocal<RequestContext>REQUEST_CONTEXT_INHERITABLE_THREAD_LOCAL=......
  • Spring Cloud Netflix第一代网关之Zuul基本使用
    网关在微服务系统中起到一个门户的作用,主要作用如下:服务路由鉴权服务熔断流控灰度发布等常用的网关有Zuul、Gateway、OpenResty+Lua、Kong、ApiSIX等等。本文以Z......
  • MyBaits操作经验目录贴        MyBatis--------Oracle关于0开头的小数,开头的0消
         ​​MyBatis-------​​​​-​​​​批量插入​​    ​​MyBatis--------模糊查询​​     ​​MyBatis--------生成主键​​   ......
  • FTP配置多用户多目录多权限
    环境介绍根据开发的需求要求创建FTP服务器,把前端和后端分开用不同的FTP账号系统环境centos7.4防火墙设置systemctlstopfirewalld.service#停止firewall(防火墙)system......
  • springMvc12(拦截器)
    一、拦截器的过程:(1)浏览器发送一个请求会先到Tomcat的web服务器(2)Tomcat服务器接收到请求以后,会去判断请求的是静态资源还是动态资源(3)如果是静态资源,会直接到Tom......
  • visual studio code的markdown生成侧边栏目录
    1,安装扩展 MarkdownPreviewEnhanced2,设置 EnableScriptExecution3,设置md文件头部在md文件头部输入以下内容,注意锁进(头部文件规则说明前点击这里)---html:......