首页 > 其他分享 >一、创建springboot项目

一、创建springboot项目

时间:2023-07-19 09:44:25浏览次数:28  
标签:__ springboot 项目 创建 boot springframework spring org

1. 创建父项目

创建新工程

父工程无需选择依赖

 

2. 创建第一个子模块

选择spring web依赖

2.1. 项目结构

 

2.2. pom.xml文件

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.7.13</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.wzh</groupId>
	<artifactId>_1_springboot</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>_1_springboot</name>
	<description>_1_springboot</description>
	<properties>
		<java.version>1.8</java.version>
	</properties>
	<dependencies>
		<!--web依赖-->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

</project>

2.3. 添加Controller代码

package com.wzh._1_springboot.controller;

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

@RestController
@RequestMapping("/")
public class HelloController {
    @GetMapping("/hello")
    public String hello() {
        return "hello world!";
    }
}

 

2.4. 浏览器访问http://localhost:8080/hello

 

3. 自定义banner

3.1. 在resources目录下创建banner.txt文件

 

             _
__      _____| |__     __ _ _ __  _ __
\ \ /\ / /_  / '_ \   / _` | '_ \| '_ \
 \ V  V / / /| | | | | (_| | |_) | |_) |
  \_/\_/ /___|_| |_|  \__,_| .__/| .__/
                           |_|   |_|             _
__      _____| |__     __ _ _ __  _ __
\ \ /\ / /_  / '_ \   / _` | '_ \| '_ \
 \ V  V / / /| | | | | (_| | |_) | |_) |
  \_/\_/ /___|_| |_|  \__,_| .__/| .__/
                           |_|   |_|

 

3.2. 项目启动效果

 

以上


标签:__,springboot,项目,创建,boot,springframework,spring,org
From: https://www.cnblogs.com/spike007blogs/p/17564715.html

相关文章

  • springBoot 2.7.x整合 swagger2.9
    1.添加依赖<!--swagger--><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.9.2</version></dep......
  • springboot开启jdk虚拟线程
    修改编译参数<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><compilerArgs>--enable-preview</compilerArgs></configura......
  • 【组态王快速搭建项目】
    1.批量导入变量(准备写一个博图v16导出的csv变量自动转换成组态王的变量小插件)2.做一台设备的demo变量后缀尽量都用[1]或者1什么来区分,然后把一个设备生成图库(或者组合成一个元素,经测试都可以替换)。3.然后选择自定义的图库添加,选中要修改的元素,再ctrl+H选择部分字符替换即可......
  • 学城项目支付宝支付模块
    1.支付宝开放平台链接地址:https://open.alipay.com/develop/manage2.下载支付宝开放平台密钥工具链接地址:https://opendocs.alipay.com/common/02kipk3.安装支付宝的依赖模块pipinstallpython-alipay-sdk--upgrade4.建立apppython../../manage.pystartapporder......
  • Go语言Revel框架,创建一个Web App
    首先请确保Revel环境搭配好了,搭配方式参看: 在命令行依次执行下面命令:cd$GOPATHrevelnewmyapprevelrunmyapp执行的结果提示如下:上面有个提示,CodepathshouldbeinGOPATH,butisinGOROOT。这是因为之前我下载revel代码时,还没有设置GOPATH,goget自动就下载GOROOT目......
  • ORACLE数据库启停、闪回和锁表查询以及创建DBLINK
    数据库启动和停止停止orcale/oracle7//停止1.ps-ef|grepsmon2.exportORACLE_SID=cbsdba(cbsdba是实例名)3.sqlplus/assysdba 4.shutdown immediate;启动1.ps-ef|grepsmon2.exportORACLE_SID=cbsdba3.sqlplus/assysdba 4.startup;5.alter pluggabledatabas......
  • springboot下使用rabbitMQ之开发配置方式(二)
    springboot下使用rabbitMQ之传参及序列化(二)消息参数传递在开发中也是个坑,不论使用内置的SimpleMessageConverter还是Jackson2JsonMessageConverter均无法让Consumer接收动态参数一.序列化的问题首先贴出具体代码以及测试用例:消费者@RabbitListener(queues="text.q......
  • 项目立项说明书:GPU自动化
    项目名称:GPU自动化项目概述:本项目旨在开发一个GPU自动化系统,通过编写脚本和使用自动化工具,实现对GPU的管理、监控和任务调度。该系统将提供一种方便和高效的方式来管理大规模GPU集群,优化资源利用和任务执行,并提供实时的性能监控和报告。项目目标:实现GPU资源的......
  • 如何向已有的项目中添加C/C++代码?
    第一步:我们需要在src/main下面建立一个cpp目录,然后在其中写一个CMakeLists.txt文件和一个cpp文件,直接给出代码:#CMakeLists.txt文件#FormoreinformationaboutusingCMakewithAndroidStudio,readthe#documentation:https://d.android.com/studio/projects/add-n......
  • Damiler EDI 项目 Excel 方案开源介绍
    准备下载和运行DaimlerEDI到Excel使用Excel生成一系列EDI文档与Daimler通信。下载工作流  下载示例文件  DaimlerEDI&Excel方案简介本文将继续分享Daimler示例工作流:使用Excel端口和Email端口生成一系列文件,完成与Daimler的EDI通信。DaimlerEDI到Excel示......