当前位置: 首页 > 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;也称为…...

vscode(仍待补充)

写于2025 6.9 主包将加入vscode这个更权威的圈子 vscode的基本使用 侧边栏 vscode还能连接ssh&#xff1f; debug时使用的launch文件 1.task.json {"tasks": [{"type": "cppbuild","label": "C/C: gcc.exe 生成活动文件"…...

连锁超市冷库节能解决方案:如何实现超市降本增效

在连锁超市冷库运营中&#xff0c;高能耗、设备损耗快、人工管理低效等问题长期困扰企业。御控冷库节能解决方案通过智能控制化霜、按需化霜、实时监控、故障诊断、自动预警、远程控制开关六大核心技术&#xff0c;实现年省电费15%-60%&#xff0c;且不改动原有装备、安装快捷、…...

《用户共鸣指数(E)驱动品牌大模型种草:如何抢占大模型搜索结果情感高地》

在注意力分散、内容高度同质化的时代&#xff0c;情感连接已成为品牌破圈的关键通道。我们在服务大量品牌客户的过程中发现&#xff0c;消费者对内容的“有感”程度&#xff0c;正日益成为影响品牌传播效率与转化率的核心变量。在生成式AI驱动的内容生成与推荐环境中&#xff0…...

什么是库存周转?如何用进销存系统提高库存周转率?

你可能听说过这样一句话&#xff1a; “利润不是赚出来的&#xff0c;是管出来的。” 尤其是在制造业、批发零售、电商这类“货堆成山”的行业&#xff0c;很多企业看着销售不错&#xff0c;账上却没钱、利润也不见了&#xff0c;一翻库存才发现&#xff1a; 一堆卖不动的旧货…...

从零实现STL哈希容器:unordered_map/unordered_set封装详解

本篇文章是对C学习的STL哈希容器自主实现部分的学习分享 希望也能为你带来些帮助~ 那咱们废话不多说&#xff0c;直接开始吧&#xff01; 一、源码结构分析 1. SGISTL30实现剖析 // hash_set核心结构 template <class Value, class HashFcn, ...> class hash_set {ty…...

GitHub 趋势日报 (2025年06月08日)

&#x1f4ca; 由 TrendForge 系统生成 | &#x1f310; https://trendforge.devlive.org/ &#x1f310; 本日报中的项目描述已自动翻译为中文 &#x1f4c8; 今日获星趋势图 今日获星趋势图 884 cognee 566 dify 414 HumanSystemOptimization 414 omni-tools 321 note-gen …...

Map相关知识

数据结构 二叉树 二叉树&#xff0c;顾名思义&#xff0c;每个节点最多有两个“叉”&#xff0c;也就是两个子节点&#xff0c;分别是左子 节点和右子节点。不过&#xff0c;二叉树并不要求每个节点都有两个子节点&#xff0c;有的节点只 有左子节点&#xff0c;有的节点只有…...

Spring数据访问模块设计

前面我们已经完成了IoC和web模块的设计&#xff0c;聪明的码友立马就知道了&#xff0c;该到数据访问模块了&#xff0c;要不就这俩玩个6啊&#xff0c;查库势在必行&#xff0c;至此&#xff0c;它来了。 一、核心设计理念 1、痛点在哪 应用离不开数据&#xff08;数据库、No…...

python报错No module named ‘tensorflow.keras‘

是由于不同版本的tensorflow下的keras所在的路径不同&#xff0c;结合所安装的tensorflow的目录结构修改from语句即可。 原语句&#xff1a; from tensorflow.keras.layers import Conv1D, MaxPooling1D, LSTM, Dense 修改后&#xff1a; from tensorflow.python.keras.lay…...

LangChain知识库管理后端接口:数据库操作详解—— 构建本地知识库系统的基础《二》

这段 Python 代码是一个完整的 知识库数据库操作模块&#xff0c;用于对本地知识库系统中的知识库进行增删改查&#xff08;CRUD&#xff09;操作。它基于 SQLAlchemy ORM 框架 和一个自定义的装饰器 with_session 实现数据库会话管理。 &#x1f4d8; 一、整体功能概述 该模块…...