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

Spring Boot官方例子《Developing Your First Spring Boot Application》无法运行

官方的第一个例子就卡住了:
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#getting-started.first-application
按照要求,一步一步走:

  1. 查看Java版本和MVN版本:
$ java -version
openjdk version "17.0.4.1" 2022-08-12 LTS
OpenJDK Runtime Environment (build 17.0.4.1+1-LTS)
OpenJDK 64-Bit Server VM (build 17.0.4.1+1-LTS, mixed mode, sharing)
$ mvn -v
Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
Maven home: usr/Users/developer/tools/maven/3.8.5
Java version: 17.0.4.1, vendor: BellSoft, runtime: /Users/developer/sdkman/candidates/java/17.0.4.1-librca
  1. 创建POM文件(我放在了D:\dev\2023\000000_learn\230310_spring\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><groupId>com.example</groupId><artifactId>myproject</artifactId><version>0.0.1-SNAPSHOT</version><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.0.4</version></parent><!-- Additional lines to be added here... -->
</project>
  1. 添加类依赖,在pom.xml的<!-- Additional lines to be added here... -->下面添加:
<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
</dependencies>
  1. 创建源码文件:src/main/java/MyApplication.java
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@SpringBootApplication
public class MyApplication {@RequestMapping("/")String home() {return "Hello World!";}public static void main(String[] args) {SpringApplication.run(MyApplication.class, args);}
}
  1. 运行程序:
$ mvn spring-boot:run.   ____          _            __ _ _/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/  ___)| |_)| | | | | || (_| |  ) ) ) )'  |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot ::  (v3.0.4)
....... . . .
....... . . . (log output here)
....... . . .
........ Started MyApplication in 0.906 seconds (process running for 6.514)

多么美好,但是我的运行结果是:

D:\dev\2023\000000_learn\230310_spring>mvn spring-boot:run
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.example:myproject >------------------------
[INFO] Building myproject 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:3.0.4:run (default-cli) > test-compile @ myproject >>>
[INFO]
[INFO] --- maven-resources-plugin:3.3.0:resources (default-resources) @ myproject ---
[INFO] skip non existing resourceDirectory D:\dev\2023\000000_learn\230310_spring\src\main\resources
[INFO] skip non existing resourceDirectory D:\dev\2023\000000_learn\230310_spring\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ myproject ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\dev\2023\000000_learn\230310_spring\target\classes
[INFO]
[INFO] --- maven-resources-plugin:3.3.0:testResources (default-testResources) @ myproject ---
[INFO] skip non existing resourceDirectory D:\dev\2023\000000_learn\230310_spring\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) @ myproject ---
[INFO] No sources to compile
[INFO]
[INFO] <<< spring-boot-maven-plugin:3.0.4:run (default-cli) < test-compile @ myproject <<<
[INFO]
[INFO]
[INFO] --- spring-boot-maven-plugin:3.0.4:run (default-cli) @ myproject ---
[INFO] Attaching agents: [].   ____          _            __ _ _/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/  ___)| |_)| | | | | || (_| |  ) ) ) )'  |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot ::                (v3.0.4)2023-03-10T20:21:20.631+08:00  INFO 21024 --- [           main] MyApplication                            : Starting MyApplication using Java 17.0.2 with PID 21024 (D:\dev\2023\000000_learn\230310_spring\target\classes started by jianmin.liu in D:\dev\2023\000000_learn\230310_spring)
2023-03-10T20:21:20.631+08:00  INFO 21024 --- [           main] MyApplication                            : No active profile set, falling back to 1 default profile: "default"
2023-03-10T20:21:20.678+08:00  WARN 21024 --- [           main] ionWarningsApplicationContextInitializer :** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.2023-03-10T20:21:20.983+08:00  WARN 21024 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:D:\app\apache-maven-3.8.6\alimvn\org\springframework\boot\spring-boot-autoconfigure\3.0.4\spring-boot-autoconfigure-3.0.4.jar!/org/springframework/boot/autoconfigure/r2dbc/ConnectionFactoryConfigurations$PoolConfiguration.class]
2023-03-10T20:21:20.983+08:00  INFO 21024 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger :Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-03-10T20:21:20.999+08:00 ERROR 21024 --- [           main] o.s.boot.SpringApplication               : Application run failedorg.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:D:\app\apache-maven-3.8.6\alimvn\org\springframework\boot\spring-boot-autoconfigure\3.0.4\spring-boot-autoconfigure-3.0.4.jar!/org/springframework/boot/autoconfigure/r2dbc/ConnectionFactoryConfigurations$PoolConfiguration.class]at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:463) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:317) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:276) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:128) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:289) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:243) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:196) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:164) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:398) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:283) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:344) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:115) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:747) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:565) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[spring-boot-3.0.4.jar:3.0.4]at MyApplication.main(MyApplication.java:15) ~[classes/:na]
Caused by: java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.r2dbc.ConnectionFactoryConfigurations$PoolConfiguration due to io/r2dbc/spi/ValidationDepth not found. Make sure your own configuration does not rely on that class. This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:54) ~[spring-boot-autoconfigure-3.0.4.jar:3.0.4]at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:88) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:71) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.isConditionMatch(ClassPathScanningCandidateComponentProvider.java:518) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.isCandidateComponent(ClassPathScanningCandidateComponentProvider.java:501) ~[spring-context-6.0.6.jar:6.0.6]at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:436) ~[spring-context-6.0.6.jar:6.0.6]... 20 common frames omitted
Caused by: java.lang.NoClassDefFoundError: io/r2dbc/spi/ValidationDepthat java.base/java.lang.Class.getDeclaredFields0(Native Method) ~[na:na]at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3297) ~[na:na]at java.base/java.lang.Class.getDeclaredField(Class.java:2608) ~[na:na]at org.springframework.boot.context.properties.bind.DefaultBindConstructorProvider$Constructors.isInnerClass(DefaultBindConstructorProvider.java:147) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.DefaultBindConstructorProvider$Constructors.getCandidateConstructors(DefaultBindConstructorProvider.java:137) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.DefaultBindConstructorProvider$Constructors.getConstructors(DefaultBindConstructorProvider.java:105) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.DefaultBindConstructorProvider.getBindConstructor(DefaultBindConstructorProvider.java:44) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.ValueObjectBinder$ValueObject.get(ValueObjectBinder.java:190) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.ValueObjectBinder.bind(ValueObjectBinder.java:67) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:476) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:590) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:576) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:474) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:414) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:343) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:332) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:262) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:223) ~[spring-boot-3.0.4.jar:3.0.4]at org.springframework.boot.autoconfigure.r2dbc.ConnectionFactoryConfigurations$PooledConnectionFactoryCondition.getMatchOutcome(ConnectionFactoryConfigurations.java:139) ~[spring-boot-autoconfigure-3.0.4.jar:3.0.4]at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-3.0.4.jar:3.0.4]... 26 common frames omitted
Caused by: java.lang.ClassNotFoundException: io.r2dbc.spi.ValidationDepthat java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]... 46 common frames omitted[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.108 s
[INFO] Finished at: 2023-03-10T20:21:21+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.0.4:run (default-cli) on project myproject: Process terminated with exit code: 1 -> [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/MojoExecutionException

查了很多都说是因为JAVA版本不对,但实际上是缺少对package的声明。
只要在src/main/java/MyApplication.java的第一行加上:

package com.example.myproject;

就解决了。

搞笑的是,官方文档也提出了,在写程序的时候“最好”要写上default package,但是他却没有这么做。。

6.2.1. Using the “default” Package
When a class does not include a package declaration, it is considered to be in the “default package”. The use of the “default package” is generally discouraged and should be avoided. It can cause particular problems for Spring Boot applications that use the @ComponentScan, @ConfigurationPropertiesScan, @EntityScan, or @SpringBootApplication annotations, since every class from every jar is read.

We recommend that you follow Java’s recommended package naming conventions and use a reversed domain name (for example, com.example.project).

相关文章:

Spring Boot官方例子《Developing Your First Spring Boot Application》无法运行

官方的第一个例子就卡住了&#xff1a; https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#getting-started.first-application 按照要求&#xff0c;一步一步走&#xff1a; 查看Java版本和MVN版本&#xff1a; $ java -version openjdk version &quo…...

数据结构(3)— 线性表之顺序存储详解介绍(含代码)

&#xff08;1&#xff09;博客代码在数据结构代码---GitHub仓库&#xff1b;线性表介绍线性表的基础概念&#xff08;1&#xff09;甲骨文表示&#xff1a;线性表是零个或多个数据元素的有限序列。&#xff08;2&#xff09;线性表&#xff0c;顾名思义&#xff0c;就是说这个…...

ChatGPT正当时,让我们一起深耕智能内容生成和智能内容增强领域

ChatGPT以其强大的信息整合和对话能力惊艳了全球&#xff0c;在自然语言处理上面表现出了惊人的能力。很多人都预测 2023 年将是 AI 生成之年&#xff0c;也许我们将迎来继农业革命、工业革命以来的第三种通用技术的普及。 信必优长期专注于人工智能领域&#xff0c;拥有产品研…...

天梯赛训练L1-019 (谁先倒)

目录 1、L1-019 谁先倒 2、如果帮到大家&#xff0c;请大家一键三连&#xff01;&#xff01;&#xff01; 3、读书吧&#xff0c;在落幕无光时找到方向&#xff01;&#xff01;&#xff01; 1、L1-019 谁先倒 分数 15 题目通道 划拳是古老中国酒文化的一个有趣的组成部分…...

MySQL DQL语句基础(一)

目录 DQL 基本语法 基础查询 1、查询多个字段 2、字段设置别名 3、去除重复记录 条件查询 语法 条件 案例 聚合函数 常见的聚合函数 语法 DQL DQL英文全称是Data Query Language(数据查询语言)&#xff0c;数据查询语言&#xff0c;用来查询数据库中表的记录。 基…...

ccc-pytorch-LSTM(8)

文章目录一、LSTM简介二、LSTM中的核心结构三、如何解决RNN中的梯度消失/爆炸问题四、情感分类实战&#xff08;google colab&#xff09;一、LSTM简介 LSTM&#xff08;long short-term memory&#xff09;长短期记忆网络&#xff0c;RNN的改进&#xff0c;克服了RNN中“记忆…...

教育小程序开发解决方案

如今无论是国家还是家庭对于教育的重视性也越来越高&#xff0c;都希望自己的孩子能够赢在起跑线上&#xff0c;但是因为工作的缘故许多家长并没有过多的精力去辅导孩子学习&#xff0c;再加上许多家长对于教育也并没有经验与技巧。而这些都充分体现了正确教育的重要性。 那么一…...

动态规划之股票问题大总结

参考资料&#xff1a;代码随想录 (programmercarl.com)一、只能买卖一次题目链接&#xff1a;121. 买卖股票的最佳时机 - 力扣&#xff08;LeetCode&#xff09;算法思想&#xff1a;设置两种状态:0表示已持有股票&#xff0c;1表示未持有股票1.dp[i][0]表示第i天已持有股票时&…...

我来跟你讲vue进阶

一、组件&#xff08;重点&#xff09; 组件&#xff08;Component&#xff09;是 Vue.js 最强大的功能之一。 组件可以扩展 HTML 元素&#xff0c;封装可重用的代码。 组件系统让我们可以用独立可复用的小组件来构建大型应用&#xff0c;几乎任意类型的应用的界面都可以抽象…...

#847(Div3)E. Vlad and a Pair of Numbers

原题链接&#xff1a; E. Vlad and a Pair of Numbers 题意&#xff1a; 题目有公式 a⊕b(ab)/2xa ⊕ b (a b) / 2 xa⊕b(ab)/2x&#xff0c; 给你的是 xxx&#xff0c;让输出一组满足题目要求的 a&#xff0c;ba&#xff0c;ba&#xff0c;b&#xff0c;没有就输出−1-1…...

怎么把pdf转换成图片?这个方法你值得拥有

想要高效率的工作&#xff0c;除了需要大家合理安排时间之外&#xff0c;一些能够辅助高效工作的工具也是必不可少的。就拿要把一份pdf文件转换成若干图片来说&#xff0c;如果不知道方法&#xff0c;找不到合适的转换工具&#xff0c;那么想要完成这一任务&#xff0c;势必要花…...

go语言使用append向二维数组添加一维数组

var ans [][]int ans append(ans, append([]int(nil), nums...))&#xff08;正确写法&#xff09;需要注意的是&#xff0c;为了避免对原切片造成影响&#xff0c;代码在将当前排列追加到结果数组 ans 时&#xff0c;使用了 append(ans, append([]int(nil), nums…)) 的方式…...

YOLOv5训练大规模的遥感实例分割数据集 iSAID从切图到数据集制作及训练

最近想训练遥感实例分割&#xff0c;纵观博客发现较少相关 iSAID数据集的切分及数据集转换内容&#xff0c;思来想去应该在繁忙之中抽出时间写个详细的教程。 iSAID数据集下载 iSAID数据集链接 下载上述数据集。 百度网盘中的train和val中包含了实例和语义分割标签。 上述…...

js学习5(函数)

目录 定义函数 函数的特性 使用函数模拟类 模拟私有属性和方法 闭包 函数特性利用 箭头函数 定义函数 function func1(name) { console.log(name); } func2 function (name) { console.log(name); } func3 function func0(name) { console.log(name); } co…...

用Qt画一个仪表盘

关于Qt Qt是一个跨平台的C图形用户界面应用程序框架&#xff0c;通过使用Qt&#xff0c;可以快速开发出跨平台的多平台应用程序&#xff0c;包括Windows、Mac OS X、Linux和其他Unix系统。Qt提供了强大的图形操作界面&#xff08;GUI&#xff09;程序开发和移植的能力&#xf…...

linux 端口查询命令

任何知识都是用进废退&#xff0c;有段时间没摸linux&#xff0c;这大脑里的知识点仿佛全部消失了&#xff0c;就无语。 索性&#xff0c;再写一篇记录&#xff0c;加强一下记忆&#xff0c;下次需要就看自己的资料好了。lsof命令Linux端口查询命令可以通过lsof实现&#xff1a…...

C语言函数: 字符串函数及模拟实现strtok()、strstr()、strerror()

C语言函数&#xff1a; 字符串函数及模拟实现strtok()、strstr()、strerror() strstr()函数: 作用&#xff1a;字符串查找。在一串字符串中&#xff0c;查找另一串字符串是否存在。 形参: str2在str1中寻找。返回值是char*的指针 原理&#xff1a;如果在str1中找到了str2&…...

【学习笔记】人工智能哲学研究:《心智、语言和机器》

关于人工智能哲学&#xff0c;我曾在这篇文章里 【脑洞大开】从哲学角度看人工智能&#xff1a;介绍徐英瑾的《心智、语言和机器》 做过介绍。图片来源&#xff1a;http://product.dangdang.com/29419969.html在我完成了一些人工智能相关的工作以后&#xff0c;我再来分享《心智…...

设计模式之门面模式(外观模式)

目录 1.模式定义 2.应用场景 2.1 电源总开关例子 2.2 股民炒股场景 ​编辑 3. 实例如下 4. 门面模式的优缺点 传送门&#xff1a; 项目中用到的责任链模式 给对象讲工厂模式&#xff0c;必须易懂易会 策略模式&#xff0c;工作中你用上了吗&#xff1f; 1.模式定…...

MySQL - 多表查询

目录1. 多表查询示例2. 多表查询分类2.1 等/非等值连接2.1.1 等值连接2.1.2非等值连接2.2 自然/非自然连接2.3 内/外连接2.3.1 内连接2.3.2 外连接3.UNION的使用3.1 合并查询结果3.1.1 UNION操作符3.1.2 UNION ALL操作符4. 7种JOIN操作5. join 多张表多表查询&#xff0c;也称为…...

自定义报表是什么?

自定义报表是指根据用户的需求和要求&#xff0c;自行设计和生成的报表。自定义报表可以根据用户的具体需求&#xff0c;选择需要的数据和指标&#xff0c;进行灵活的排列和组合&#xff0c;生成符合用户要求的报表。自定义报表可以帮助用户更好地了解业务情况&#xff0c;发现…...

windows安装docker-小白用【避坑】【伸手党福利】

目录实操开启 Hyper-V 和容器特性下载docker安装dockercmd中&#xff0c;使用命令测试是否成功报错解决办法&#xff1a;下载linux模拟器wsl&#xff1a;双击打开docker重新打开cmd&#xff0c;输入命令&#xff0c;成功显示sever和clinet实操 开启 Hyper-V 和容器特性 控制面…...

环形链表相关的练习

目录 一、相交链表 二、环形链表 三、环形链表 || 一、相交链表 给你两个单链表的头节点 headA 和 headB &#xff0c;请你找出并返回两个单链表相交的起始节点。如果两个链表不存在相交节点&#xff0c;返回 null 。 图示两个链表在节点 c1 开始相交&#xff1a; 题目数据…...

C++ 提示对话框

头文件 #include<iostream>#include<cstdio> using namespace std; 函数格式 MessageBox( HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType) 参数 hWnd &#xff1a;此参数代表消息框拥有的窗口。如果为NULL&#xff0c;则消息框没有拥有窗口。 lp…...

SprintBoot打包及profile文件配置

打成Jar包 需要添加打包组件将项目中的资源、配置、依赖包打到一个jar包中&#xff0c;可以使用maven的package&#xff1b;运行: java -jar xxx(jar包名) 操作步骤 第一步: 引入Spring Boot打包插件 <!--打包的插件--> <build><!--修改jar的名字--><fi…...

java面试-java集合

说说你如何选用集合&#xff1f; 需要键值对选用 map 接口下的集合&#xff0c;需要排序用 TreeMap, 不需要排序用 HashMap 不需要键值对仅存放元素则选择 Collection 下实现的接口&#xff0c;保证元素唯一使用 Set, 不需要则选用 List Collection 和 Collections 有什么区别…...

Node.js简介

客户端访问网页时向服务器端发送请求要访问服务器中的页面&#xff0c;服务器收到请求后向数据库中进行搜索&#xff0c;搜索到相关数据然后返回结果给客户端显示&#xff1b; 这个过程就类似于&#xff1a;客人&#xff08;客户端&#xff09;去饭馆&#xff08;服务端&#…...

每天学一点之Lambda表达式

Lambda表达式 思想导入&#xff1a; 函数式编程思想&#xff1a; 在数学中&#xff0c;函数就是有输入量、输出量的一套计算方案&#xff0c;也就是“拿什么东西做什么事情”。编程中的函数&#xff0c;也有类似的概念&#xff0c;你调用我的时候&#xff0c;给我实参为形参赋…...

Raft分布式共识算法学习笔记

1. Raft算法 Raft算法属于Multi-Paxos算法&#xff0c;它是在Multi-Paxos思想的基础上&#xff0c;做了一些简化和限制&#xff0c;比如增加了日志必须是连续的&#xff0c;只支持领导者、跟随者和候选人三种状态&#xff0c;在理解和算法实现上都相对容易许多 从本质上说&am…...

中介者模式

介绍 Java中介者模式(Mediator Pattern)是一种行为设计模式,它可以降低多个对象之间的耦合性,通过一个中介者对象来协调这些对象的交互. 在中介者模式中,多个对象之间的交互不是直接进行的,而是通过一个中介者对象来进行的.这个中介者对象封装了对象之间的交互逻辑,每个对象只…...

Kaggle赛题解析:Google手语识别

文章目录一、比赛前言信息二、比赛背景三、比赛任务四、评价指标五、数据描述六、解题思路一、比赛前言信息 比赛名称&#xff1a;Google - Isolated Sign Language Recognition 中文名称&#xff1a;帮助用户从PopSign游戏学习美国手语 比赛链接&#xff1a;https://www.ka…...

什么是ChatGPT?

目录前言一、什么是GPT&#xff1f;二、什么是ChatGPT&#xff1f;三、ChatGPT应用场景四、ChatGPT未来展望五、OpenAI介绍前言 3月3号&#xff0c;早上6:30就有人发消息给我&#xff0c;来问我有关GPT API的事件。 那是因为3月2号&#xff0c;OpenAI 发布了ChatGPT 3.5的开放…...

深入理解Zookeeper的ZAB协议

ZAB是什么ZAB&#xff08;Zookeeper Atomic Broadcast&#xff09;&#xff1a;Zookeeper原子广播ZAB是为了保证Zookeeper数据一致性而产生的算法&#xff08;指的是Zookeeper集群模式&#xff09;。它不仅能解决正常情况下的数据一致性问题&#xff0c;还可以保证主节点发生宕…...

opencv-图像几何处理

缩放 缩放只是调整图像的大小。为此&#xff0c;opencv提供了一个cv2.resize()函数&#xff0c;可以手动指定图像大小&#xff0c;也可以指定缩放因子。你可以使用任意一种方法调整图像的大小&#xff1a; import cv2 from matplotlib import pyplot as pltlogo cv2.imread(…...

[前端笔记030]vue之hello、数据绑定、MVVM、数据代理、事件处理、计算属性和监视属性

前言 本笔记参考视频&#xff0c;尚硅谷:BV1Zy4y1K7SH p1 -p25官网文档完善&#xff0c;本文只做笔记使用&#xff0c;官网下载vue的开发版和生产版或者使用CDN&#xff0c;并去谷歌商店下载开发插件 简介 组件化模式&#xff0c;提高代码复用率&#xff0c;更好维护声明式编…...

每天学一点之注解、元注解

注解 1、注解概述 定义&#xff1a; 注解&#xff08;Annotation&#xff09;&#xff0c;也叫元数据。与类、接口、枚举是在同一个层次。它可以声明在包、类、字段、方法、局部变量、方法参数等的前面&#xff0c;用来对这些元素进行说明&#xff0c;注释。 作用分类&#…...

STA环境

目录1. CMOS逻辑门2. 波形3. 时钟3.1. 指定时钟create_clock时钟延迟set_clock_latency 时钟不确定度set_clock_uncertainty 跨时钟域set_false_path3.2. 衍生时钟3.3. 虚拟时钟4. 时序路径2.1. 输入路径2.2. 输出路径2.3. 点对点约束本文介绍在执行静态时序分析&#xff08;St…...

嵌入式系统实践 12 ——基于ARM汇编 Keil5 MSP432 P401R开发板

物联网实验1 阿里云远程控制小灯 ///****************************************************************************** // * // * MSP432P401 // * ----------------- // * | | // * | |…...

【密码学篇】密码行业标准汇总(GM)

【密码学篇】密码行业标准汇总&#xff08;GM&#xff09; 截止到2023年03月10日&#xff0c;共130个密码行业标准&#xff0c;适用商用密码应用与安全性评估等密码行业&#xff0c;可点击链接预览或下载标准—【蘇小沐】 文章目录【密码学篇】密码行业标准汇总&#xff08;GM…...

桌面文件删除后没有在回收站原因和恢复方法

桌面误删文件回收站也没有怎么办&#xff1f;遇到电脑桌面文件误删了&#xff0c;重要数据回收站找不回这种情况不要慌&#xff01;如今数据恢复技术很成熟&#xff0c;许多文件丢失问题都能够成功解决。下面我们就一起来了解下桌面误删文件回收站没有的原因和相关文件恢复方法…...

什么是业务运营?关键组成部分有哪些?

企业领导者使用收入运营和智能软件等技术来分析买家的不同接触点。这些见解决定了客户互动的成败&#xff0c;从而改善了业务运营&#xff0c;从而带来了成功。 什么是业务运营&#xff1f; 业务运营包括企业为保持盈利而执行的一系列日常任务。虽然这些任务可能因业务类型或行…...

腾讯云新用户怎么配置服务器的方法教程

腾讯云新用户怎么配置服务器&#xff1f;腾讯云服务器配置选择攻略&#xff0c;先选择云服务器地域和可用区&#xff0c;然后根据用户使用场景需要平衡型、计算型或高IO型等特性来选择云服务器CVM实例规格&#xff0c;主机教程网来详细说下腾讯云服务器配置选择攻略。 1、腾讯云…...

windows 11系统,通过ip地址远程连接连接ubuntu 22.04系统(共同局域网下,另一台主机不需要联网)

windows 11系统&#xff0c;通过ip地址远程连接连接ubuntu 22.04系统&#xff08;不需要联网&#xff09;问题来源问题分析解决方案问题来源 自己搭建了一台ubuntu系统作为深度学习的机器&#xff0c;但是学校的网络问题&#xff0c;一个账号只能同时登录3台设备。通过远程连接…...

头脑风暴(一):Controller层前端传参接收;在Service层实现类中?为何要build相关构建器?添加套餐业务分析

文章目录1 MyBatis中Controller层List集合接收数据&#xff0c;泛型添加与否1.1 案例场景1.2 应该用什么接收1.3 是否可以用其他方式接收&#xff1f;1.4 LIst集合接收可否不指定泛型1.5 mybatis中使用基本类型接收数据&#xff1f;resultType是集合中的元素的类型&#xff0c;…...

vue-cropper 拖动图片和截图框

现象 开发遇到vue--cropper不能拖动图片和截图框 解决方法 can-move-box设置为true&#xff0c;表示可以拖动截图框 can-move设置为true&#xff0c;表示可以拖动图片 *注意&#xff1a; 我外层套了一个el-col, el-col的宽高一定要大于截图框的宽高&#xff0c;否则移动不了…...

[Linux基础]history相关的环境变量设置

目录 背景 简介 命令操作 1. 语法&#xff1a; 2. 功能 3. 参数 环境变量设置 背景 工作中时常收到客户的反馈&#xff0c;我的系统什么也没干&#xff0c;就出现文件丢失&#xff0c;程序错误等等问题&#xff1b;我们在问题排查的时候查看history信息也是重要环节…...

怎么给电脑分盘与合并磁盘?教你三招

电脑只有一个C盘&#xff0c;想要再分出一个或多个分区&#xff0c;怎么办&#xff1f;电脑C盘的容量太小&#xff0c;太容易满了&#xff0c;想重新分盘&#xff0c;或者把其他盘跟它合并&#xff0c;但因为文件太多备份实在是太麻烦&#xff0c;怎么办&#xff1f;怎么给电脑…...

HCIP-5.4OSPF路由聚合、缺省路由

1、路由聚合 OSPF 是一种链路状态路由协议&#xff0c;因此 OSPF路由器不传输路由&#xff0c;而是传输链路状态信息。因此&#xff0c;OSPF 路由通过汇总 LSA 来控制链路状态信息的传输&#xff0c;从而减小 LSDB 数据库的大小&#xff0c;进而控制路由的汇总。 由于OSPF路由…...

【数据结构】——树与二叉树

文章目录树二叉树二叉树的性质完全二叉树二叉树的存储遍历二叉树和线索二叉树6.4 树和森林哈夫曼树应用树 树的定义&#xff1a;树是以分支关系定义的层次结构。 D; 树(Tree)是n(n≥0)个结点的有限集。 R 数据关系 有且仅有一个特定的称为根(Root) 的结点 当n>1时&…...

等离子纳秒高压脉冲电源维修HVP-20 P

等离子纳秒高压脉冲电源维修HVP-20 P;HVP-10B;HVP-05;HVP-02等型号均可维修 HVP-20 P(N)用于气体放电与低温等离子体的高性能纳秒高压脉冲电源。 HVP-20P(N)采用专有的marx电路&#xff0c;实现高压脉冲电源参数的便捷可调&#xff0c;包括峰值电压0 – 20 KV &#xff08;-2…...