当前位置: 首页 > news >正文

2022年0903我的SpringBoot框架入门的第一个程序

目录

 

第一点:在学习SpringBoot框架前要具备下面的知识.

1 学过java的基础课程 java的基础课程 面向对象,异常处理,存储方式,JDBC,文件的上转下载。

2 学过Jsp和Service的编程  了解Service的几个重要的对象 了解Service的生命周期

九大内置对象 四大作用域  El 核心标签库

3 学过前端的一些内容 HTML CSS CSS3 JavaScript Jquery   Ajax Json

4 学过SSM框架中的三个基本框架的操作 SpringMvc Spring MyBatis 并且在脑子中有非常清晰的三层架构的流程图

学过之前的 SpringMvc Spring MyBatis

5 在此之前学过Maven这项技术 会在命令窗口构建Maven的项目 web项目 生命周期 依赖的关系 理解约定大于配置的关键

会配置maven的各种环境

上面只是大致的内容

第二点:Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.

Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。通过这种方式,Spring Boot致力于在蓬勃发展的快速应用开发领域(rapid application development)成为领导者。

第三点:SpringBoot百度官网.

https://baike.baidu.com/item/Spring%20Boot/20249767?fr=aladdinSpringBoot基于Spring4.0设计,不仅继承了Spring框架原有的优秀特性,而且还通过简化配置来进一步简化了Spring应用的整个搭建和开发过程。另外SpringBoot通过集成大量的框架使得依赖包的版本冲突,以及引用的不稳定性等问题得到了很好的解决。

第四点 SpringBoot所具备的特征有.

(1)可以创建独立的Spring应用程序,并且基于其Maven或Gradle插件,可以创建可执行的JARs和WARs;

(2)内嵌Tomcat或Jetty等Servlet容器;

(3)提供自动配置的“starter”项目对象模型(POMS)以简化Maven配置;

(4)尽可能自动配置Spring容器;

(5)提供准备好的特性,如指标、健康检查和外部化配置;

(6)绝对没有代码生成,不需要XML配置。

第五点 了解两个官网.

SpringBoot官网:https://spring.io/Maven的官网:https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api/4.0.1?__cf_chl_tk=CeJqhhBtdUnKrkCSrIRShKxBXWtkk0dgVCzpyhEdv.U-1662186144-0-gaNycGzNCmU

第六点 为什么要学习SpringBoot框架.具体整理一下 Spring Boot 的优点有1、自动配置

2、依赖管理变得简单

3、内置 Tomcat、Jetty 容器

第七部分:Spring官网的学习:https://spring.io/

@1 方式一创建Springboot项目 在官网上创建 初学者不建议用方案一

@2 利用Idea软件创建我的第一个SpringBoot程序。

前期的预备工作 自己电脑上必须有以下设置:

Java中的Jdk  Maven的环境配置完整 有自己的本地仓库 请看下面的图示

 测试判断环境的配置是否成功

环境配置完成后接下来创建Idea的第一个SpringBoot程序:

第一点:在学习SpringBoot框架前要具备下面的知识.

  • 1 学过java的基础课程 java的基础课程 面向对象,异常处理,存储方式,JDBC,文件的上转下载。

  • 2 学过Jsp和Service的编程  了解Service的几个重要的对象 了解Service的生命周期

  • 九大内置对象 四大作用域  El 核心标签库

  • 3 学过前端的一些内容 HTML CSS CSS3 JavaScript Jquery   Ajax Json

  • 4 学过SSM框架中的三个基本框架的操作 SpringMvc Spring MyBatis 并且在脑子中有非常清晰的三层架构的流程图

  • 学过之前的 SpringMvc Spring MyBatis

  • 5 在此之前学过Maven这项技术 会在命令窗口构建Maven的项目 web项目 生命周期 依赖的关系 理解约定大于配置的关键

  • 会配置maven的各种环境

  • 上面只是大致的内容

第二点:Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.

Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程。
该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。
通过这种方式,Spring Boot致力于在蓬勃发展的快速应用开发领域(rapid application development)成为领导者。

第三点:SpringBoot百度官网.

https://baike.baidu.com/item/Spring%20Boot/20249767?fr=aladdin
SpringBoot基于Spring4.0设计,不仅继承了Spring框架原有的优秀特性,
而且还通过简化配置来进一步简化了Spring应用的整个搭建和开发过程。
另外SpringBoot通过集成大量的框架使得依赖包的版本冲突,以及引用的不稳定性等问题得到了很好的解决。

第四点 SpringBoot所具备的特征有.

  • (1)可以创建独立的Spring应用程序,并且基于其Maven或Gradle插件,可以创建可执行的JARs和WARs;

  • (2)内嵌Tomcat或Jetty等Servlet容器;

  • (3)提供自动配置的“starter”项目对象模型(POMS)以简化Maven配置;

  • (4)尽可能自动配置Spring容器;

  • (5)提供准备好的特性,如指标、健康检查和外部化配置;

  • (6)绝对没有代码生成,不需要XML配置。

第五点 了解两个官网.

SpringBoot官网:https://spring.io/
Maven的官网:
https://mvnrepository.com/artifact/javax.servlet
/javax.servlet-api/4.0.1?__cf_chl_tk
=CeJqhhBtdUnKrkCSrIRShKxBXWtkk0dgVCzpyhEdv.U-1662186144-0-gaNycGzNCmU

第六点 为什么要学习SpringBoot框架.
具体整理一下 Spring Boot 的优点有
1、自动配置

2、依赖管理变得简单

3、内置 Tomcat、Jetty 容器

第七部分:Spring官网的学习:https://spring.io/

@1 方式一创建Springboot项目 在官网上创建 初学者不建议用方案一

<?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.3</version>
    <relativePath/> <!-- lookup parent from repository -->
  </parent>
  <groupId>com.example</groupId>
  <artifactId>demo</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>demo</name>
  <description>Demo project for Spring Boot</description>
  <properties>
    <java.version>17</java.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</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 利用Idea软件创建我的第一个SpringBoot程序。

前期的预备工作 自己电脑上必须有以下设置:

Java中的Jdk  Maven的环境配置完整 有自己的本地仓库 请看下面的图示

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<!-- 
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
 -->
<!-- 
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 | -->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!--  localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
   -->
<localRepository>d:\maven_repository</localRepository>
<!--  interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
   -->
<!--  offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
   -->
<!--  pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   | -->
<pluginGroups>
<!--  pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
     -->
</pluginGroups>
<!--  proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   | -->
<proxies>
<!--  proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
     -->
</proxies>
<!--  servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   | -->
<servers>
<!--  server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
     -->
<!--  Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
     -->
</servers>
<!--  mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   | -->
<mirrors>
<!--  mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
      -->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
<!--  profiles
   | This is a list of profiles which can be activated in a variety of ways, and which can modify
   | the build process. Profiles provided in the settings.xml are intended to provide local machine-
   | specific paths and repository locations which allow the build to work in the local environment.
   |
   | For example, if you have an integration testing plugin - like cactus - that needs to know where
   | your Tomcat instance is installed, you can provide a variable here such that the variable is
   | dereferenced during the build process to configure the cactus plugin.
   |
   | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
   | section of this document (settings.xml) - will be discussed later. Another way essentially
   | relies on the detection of a system property, either matching a particular value for the property,
   | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
   | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
   | Finally, the list of active profiles can be specified directly from the command line.
   |
   | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
   |       repositories, plugin repositories, and free-form properties to be used as configuration
   |       variables for plugins in the POM.
   |
   | -->
<profiles>
<!--  profile
     | Specifies a set of introductions to the build process, to be activated using one or more of the
     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
     | or the command line, profiles have to have an ID that is unique.
     |
     | An encouraged best practice for profile identification is to use a consistent naming convention
     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
     | This will make it more intuitive to understand what the set of introduced profiles is attempting
     | to accomplish, particularly when you only have a list of profile id's for debug.
     |
     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
    <profile>
      <id>jdk-1.4</id>

      <activation>
        <jdk>1.4</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
     -->
<!-- 
     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
     | might hypothetically look like:
     |
     | ...
     | <plugin>
     |   <groupId>org.myco.myplugins</groupId>
     |   <artifactId>myplugin</artifactId>
     |
     |   <configuration>
     |     <tomcatLocation>${tomcatPath}</tomcatLocation>
     |   </configuration>
     | </plugin>
     | ...
     |
     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
     |       anything, you could just leave off the <value/> inside the activation-property.
     |
    <profile>
      <id>env-dev</id>

      <activation>
        <property>
          <name>target-env</name>
          <value>dev</value>
        </property>
      </activation>

      <properties>
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
      </properties>
    </profile>
     -->
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maver.compiler.compilerVersion>1.8</maver.compiler.compilerVersion>
</properties>
</profile>
</profiles>
<!--  activeProfiles
   | List of profiles that are active for all builds.
   |
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  </activeProfiles>
   -->
</settings>

 测试判断环境的配置是否成功

Microsoft Windows [版本 10.0.22000.856]
(c) Microsoft Corporation。保留所有权利。

C:\Users\MZFAITHDREAM>javac
用法: javac <options> <source files>
其中, 可能的选项包括:
  @<filename>                  从文件读取选项和文件名
  -Akey[=value]                传递给注释处理程序的选项
  --add-modules <模块>(,<模块>)*
        除了初始模块之外要解析的根模块; 如果 <module>
                为 ALL-MODULE-PATH, 则为模块路径中的所有模块。
  --boot-class-path <path>, -bootclasspath <path>
        覆盖引导类文件的位置
  --class-path <path>, -classpath <path>, -cp <path>
        指定查找用户类文件和注释处理程序的位置
  -d <directory>               指定放置生成的类文件的位置
  -deprecation                 输出使用已过时的 API 的源位置
  --enable-preview             启用预览语言功能。要与 -source 或 --release 一起使用。
  -encoding <encoding>         指定源文件使用的字符编码
  -endorseddirs <dirs>         覆盖签名的标准路径的位置
  -extdirs <dirs>              覆盖所安装扩展的位置
  -g                           生成所有调试信息
  -g:{lines,vars,source}       只生成某些调试信息
  -g:none                      不生成任何调试信息
  -h <directory>               指定放置生成的本机标头文件的位置
  --help, -help, -?            输出此帮助消息
  --help-extra, -X             输出额外选项的帮助
  -implicit:{none,class}       指定是否为隐式引用文件生成类文件
  -J<flag>                     直接将 <标记> 传递给运行时系统
  --limit-modules <模块>(,<模块>)*
        限制可观察模块的领域
  --module <模块>(,<模块>)*, -m <模块>(,<模块>)*
        只编译指定的模块,请检查时间戳
  --module-path <path>, -p <path>
        指定查找应用程序模块的位置
  --module-source-path <module-source-path>
        指定查找多个模块的输入源文件的位置
  --module-version <版本>        指定正在编译的模块版本
  -nowarn                      不生成任何警告
  -parameters                  生成元数据以用于方法参数的反射
  -proc:{none,only}            控制是否执行注释处理和/或编译。
  -processor <class1>[,<class2>,<class3>...]
        要运行的注释处理程序的名称; 绕过默认的搜索进程
  --processor-module-path <path>
        指定查找注释处理程序的模块路径
  --processor-path <path>, -processorpath <path>
        指定查找注释处理程序的位置
  -profile <profile>           请确保使用的 API 在指定的配置文件中可用
  --release <release>
        为指定的 Java SE 发行版编译。支持的发行版:7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
  -s <directory>               指定放置生成的源文件的位置
  --source <release>, -source <release>
        提供与指定的 Java SE 发行版的源兼容性。支持的发行版:7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
  --source-path <path>, -sourcepath <path>
        指定查找输入源文件的位置
  --system <jdk>|none          覆盖系统模块位置
  --target <release>, -target <release>
        生成适合指定的 Java SE 发行版的类文件。支持的发行版:7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
  --upgrade-module-path <path>
        覆盖可升级模块位置
  -verbose                     输出有关编译器正在执行的操作的消息
  --version, -version          版本信息
  -Werror                      出现警告时终止编译


C:\Users\MZFAITHDREAM>java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

C:\Users\MZFAITHDREAM>mvn
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.123 s
[INFO] Finished at: 2022-09-03T20:00:15+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException

C:\Users\MZFAITHDREAM>mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: D:\softwhy\apache-maven-3.6.3\bin\..
Java version: 1.8.0_171, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jre1.8.0_171
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

C:\Users\MZFAITHDREAM>

环境配置完成后接下来创建Idea的第一个SpringBoot程序:

<?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>hellowoeld</groupId>
    <artifactId>com.java.springboot</artifactId>
    <version>1.0-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

<dependencies>
    <!--开发web应用的架包-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

</project>
package com.java.controller.com.java;

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

// @Controller+@ResponseBody
//http://localhost:8080/A/a
//内 有服务器
@RestController
@RequestMapping("/A")
public class HelloController {
    @RequestMapping("/a")
    public  String hello() {
        return "<h1 align=\"center\">不要因为懒惰,而错过本该属于你的人生。这个世界上优秀的人很多,但做不到的总有人会做到。\n" +
                "\n" +
                "\t\t\t你逃避的恐惧,但在有些人看来只是小事一桩。你偷懒不学的技能,有一天会用得上,你贪图安逸的过去,造就焦虑的当下。\n" +
                "\n" +
                "\t\t\t折腾也许很累很难,但至少不留遗憾不必四处寻找答案,-切皆在你手上。不要因\n" +
                "\n" +
                "\t\t\t为自己的懒散而错过本该属于你的人生,一定要努力向前跑,去见那些我们未曾见过的风景</h1>";
    }
}

package com.java.controller.com.java;

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

// @Controller+@ResponseBody
//http://localhost:8080/A/a
//内 有服务器
@RestController
@RequestMapping("/B")
public class HelloController1 {
    @RequestMapping("/a")
    public String hello() {
        return "<h1 align=\"center\">这个世界可能很大,大到自己想走遍世界的每一个角落。" +
                "这个世界可以很小,小到每天算计着柴米油盐,每天都在消费钱的路上。可能这又是生活每天都在忙碌," +
                "在忙碌的过程忽略的人是自己。忽略了自己的珍贵。忽略了自己的感受。忽略了自己的想法。</h1>";
    }
}

package com.java.controller.com.java;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


@SpringBootApplication //启动类
public class Application {
    public static void main(String[] args) {
      SpringApplication.run(Application.class,args);
    }
}

"C:\Program Files\Java\jdk1.8.0_171\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\IDEA\com.text\IntelliJ IDEA 2020.1.2\lib\idea_rt.jar=55233:D:\IDEA\com.text\IntelliJ IDEA 2020.1.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_171\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\rt.jar;D:\maven-workspace\spaceVideo\com.java.springboot\target\classes;D:\maven_repository\org\springframework\boot\spring-boot-starter-web\2.7.3\spring-boot-starter-web-2.7.3.jar;D:\maven_repository\org\springframework\boot\spring-boot-starter\2.7.3\spring-boot-starter-2.7.3.jar;D:\maven_repository\org\springframework\boot\spring-boot\2.7.3\spring-boot-2.7.3.jar;D:\maven_repository\org\springframework\boot\spring-boot-autoconfigure\2.7.3\spring-boot-autoconfigure-2.7.3.jar;D:\maven_repository\org\springframework\boot\spring-boot-starter-logging\2.7.3\spring-boot-starter-logging-2.7.3.jar;D:\maven_repository\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;D:\maven_repository\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;D:\maven_repository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\maven_repository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\maven_repository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\maven_repository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\maven_repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\maven_repository\org\springframework\spring-core\5.3.22\spring-core-5.3.22.jar;D:\maven_repository\org\springframework\spring-jcl\5.3.22\spring-jcl-5.3.22.jar;D:\maven_repository\org\yaml\snakeyaml\1.30\snakeyaml-1.30.jar;D:\maven_repository\org\springframework\boot\spring-boot-starter-json\2.7.3\spring-boot-starter-json-2.7.3.jar;D:\maven_repository\com\fasterxml\jackson\core\jackson-databind\2.13.3\jackson-databind-2.13.3.jar;D:\maven_repository\com\fasterxml\jackson\core\jackson-annotations\2.13.3\jackson-annotations-2.13.3.jar;D:\maven_repository\com\fasterxml\jackson\core\jackson-core\2.13.3\jackson-core-2.13.3.jar;D:\maven_repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.3\jackson-datatype-jdk8-2.13.3.jar;D:\maven_repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.3\jackson-datatype-jsr310-2.13.3.jar;D:\maven_repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.3\jackson-module-parameter-names-2.13.3.jar;D:\maven_repository\org\springframework\boot\spring-boot-starter-tomcat\2.7.3\spring-boot-starter-tomcat-2.7.3.jar;D:\maven_repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.65\tomcat-embed-core-9.0.65.jar;D:\maven_repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.65\tomcat-embed-el-9.0.65.jar;D:\maven_repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.65\tomcat-embed-websocket-9.0.65.jar;D:\maven_repository\org\springframework\spring-web\5.3.22\spring-web-5.3.22.jar;D:\maven_repository\org\springframework\spring-beans\5.3.22\spring-beans-5.3.22.jar;D:\maven_repository\org\springframework\spring-webmvc\5.3.22\spring-webmvc-5.3.22.jar;D:\maven_repository\org\springframework\spring-aop\5.3.22\spring-aop-5.3.22.jar;D:\maven_repository\org\springframework\spring-context\5.3.22\spring-context-5.3.22.jar;D:\maven_repository\org\springframework\spring-expression\5.3.22\spring-expression-5.3.22.jar" com.java.controller.com.java.Application

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.3)

2022-09-03 20:08:42.239  INFO 32124 --- [           main] c.java.controller.com.java.Application   : Starting Application using Java 1.8.0_171 on HELLOWWORLD with PID 32124 (D:\maven-workspace\spaceVideo\com.java.springboot\target\classes started by MZFAITHDREAM in D:\maven-workspace\spaceVideo\com.java.springboot)
2022-09-03 20:08:42.243  INFO 32124 --- [           main] c.java.controller.com.java.Application   : No active profile set, falling back to 1 default profile: "default"
2022-09-03 20:08:43.767  INFO 32124 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-09-03 20:08:43.779  INFO 32124 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-09-03 20:08:43.780  INFO 32124 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.65]
2022-09-03 20:08:44.301  INFO 32124 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-09-03 20:08:44.301  INFO 32124 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1979 ms
2022-09-03 20:08:44.729  INFO 32124 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2022-09-03 20:08:44.736  INFO 32124 --- [           main] c.java.controller.com.java.Application   : Started Application in 3.177 seconds (JVM running for 4.833)

相关文章:

  • 【高阶数据结构】并查集的实现(含压缩路径)及其应用-C++版本
  • Java——线程不安全的原因(图解)
  • [数据结构]~双向+循环链表从(0~1)
  • 【开学季】再见大一,你好大二 | 完成自己的未完成
  • java毕业设计网站SSM版学生选课系统[包运行成功]
  • 【计算机网络】第六章:应用层
  • FS03MR12A6MA1LBBPSA1 1200V 400A 紧凑型 六单元模块
  • 系统篇: ubuntu 18.04 ROS1 和 ROS2 环境搭建
  • 贪心算法 - 买卖股票的最佳时机|| + 分割平衡字符串
  • ActiveReports.NET 16.2RPX 部分报告的完全支持
  • 专业英语第八章Communications and Networks测试题
  • 【Linux操作系统】-- 多线程(三)-- 线程池+单例模式+读写者模型
  • Pinia实操配置,Vuex的替代品
  • flume系列(一)部署示例及组件介绍
  • 【SpringBoot】静态资源导入探究
  • 【402天】跃迁之路——程序员高效学习方法论探索系列(实验阶段159-2018.03.14)...
  • Angular6错误 Service: No provider for Renderer2
  • canvas 五子棋游戏
  • dva中组件的懒加载
  • E-HPC支持多队列管理和自动伸缩
  • Facebook AccountKit 接入的坑点
  • gf框架之分页模块(五) - 自定义分页
  • GitUp, 你不可错过的秀外慧中的git工具
  • JS学习笔记——闭包
  • React Transition Group -- Transition 组件
  • 笨办法学C 练习34:动态数组
  • 技术胖1-4季视频复习— (看视频笔记)
  • 前端_面试
  • 前言-如何学习区块链
  • 算法---两个栈实现一个队列
  • 推荐一款sublime text 3 支持JSX和es201x 代码格式化的插件
  • 学习JavaScript数据结构与算法 — 树
  • 你对linux中grep命令知道多少?
  • 如何用纯 CSS 创作一个货车 loader
  • 数据库巡检项
  • (10)Linux冯诺依曼结构操作系统的再次理解
  • (Git) gitignore基础使用
  • (ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY)讲解
  • (第8天)保姆级 PL/SQL Developer 安装与配置
  • (附源码)springboot家庭财务分析系统 毕业设计641323
  • (附源码)计算机毕业设计SSM教师教学质量评价系统
  • .Family_物联网
  • .NET中使用Redis (二)
  • /usr/local/nginx/logs/nginx.pid failed (2: No such file or directory)
  • /var/spool/postfix/maildrop 下有大量文件
  • @SentinelResource详解
  • [bzoj 3124][sdoi 2013 省选] 直径
  • [C#]winform制作圆形进度条好用的圆环圆形进度条控件和使用方法
  • [ComfyUI进阶教程] animatediff视频提示词书写要点
  • [Delphi]一个功能完备的国密SM4类(TSM4)[20230329更新]
  • [python] RRT快速拓展随机树
  • [sd_scripts]之train
  • [svc]logstash和filebeat之间ssl加密
  • [TestLink]搭建指南(ubuntu)
  • [初学C语言]个人易错总结