摘要: 一文彻底弄懂Spring Boot的启动过程 一,Spring Boot启动过程 1. 启动入口 Spring Boot 应用的启动入口通常是一个包含 @SpringBootApplication 注解的主类,并调用 SpringApplication.run() 方法。@SpringBootApp 阅读全文
posted @ 2025-09-15 19:43 shanxin1954 阅读(1) 评论(0) 推荐(0)
摘要: springboot在哪里写自己的代码。 @SpringBootApplication public class FooApplication { public static void main(String[] args) { SpringApplication.run(FooApplicatio 阅读全文
posted @ 2025-09-15 19:41 shanxin1954 阅读(1) 评论(0) 推荐(0)
摘要: 试着基于jdbctemplate包装一个MysqlHelper类。连接池采用springboot默认的hikari。jdbctemplate提供基本的防注入,它的写法比jdbc好看,jdbc还需要putint,putstr。提供的另一个功能是结果集的转换。写完,测试代码的面貌如下: var sqlh 阅读全文
posted @ 2025-09-15 18:23 shanxin1954 阅读(0) 评论(0) 推荐(0)
摘要: 用jdbc操作mysqlhttps://www.runoob.com/java/java-mysql-connect.htmlmysql8之前和之后的连接配置有差异。实际使用时,一般还需要个功能,就是连接池。这个springboot自带了,是hikari。hikari初始化的时候,也需要配置mysq 阅读全文
posted @ 2025-09-14 23:29 shanxin1954 阅读(1) 评论(0) 推荐(0)
摘要: https://www.baeldung-cn.com/spring-boot-hikari 概述 Hikari 一是个JDBC数据源连接池。与其它连接池相比,它更轻量级且性能更优。 本快速教程将展示如何在基于 Spring Boot 3 的应用程序中配置 Hikari 数据源。 2. 在 Spri 阅读全文
posted @ 2025-09-14 22:29 shanxin1954 阅读(8) 评论(0) 推荐(0)
摘要: jdbc的metadata有gettables和gettablecolumns方法,只是这两个方法用起来需要小心设置参数。 获取所有用户表: var metaData = conn.getMetaData(); var itbl = metaData.getTables(conn.getCatlog 阅读全文
posted @ 2025-03-13 09:50 shanxin1954 阅读(117) 评论(0) 推荐(0)
摘要: springboot直接引入hibernate,用applications.properties当配置文件是很简单的: spring.application.name=test-hibernate spring.datasource.url=jdbc:mysql://localhost:3306/t 阅读全文
posted @ 2025-03-12 19:26 shanxin1954 阅读(26) 评论(0) 推荐(0)
摘要: hibernate升级到5.x时丢弃了一部分相关的api,目前网上版本众多,从外网上找到了一个能用的。别的看不懂。 转载 https://codingtechroom.com/question/how-to-retrieve-all-table-names-from-sessionfactory-i 阅读全文
posted @ 2025-03-11 14:59 shanxin1954 阅读(24) 评论(0) 推荐(0)
摘要: springboot引入hibernate是通过spring-boot-starter-data-jpa,并没有一个spring-boot-starter-hibernate。 然后再引入mysql的connector就可以了。 <dependency> <groupId>org.springfra 阅读全文
posted @ 2025-03-11 10:16 shanxin1954 阅读(6) 评论(0) 推荐(0)
摘要: 从官网下载安装之后,系统上没有mysql命令。 默认安装在C:\Program Files\MySQL\MySQL Server 8.4\bin 添加到系统环境变量的PATH里,重新打开cmd就有了。 阅读全文
posted @ 2025-03-11 09:52 shanxin1954 阅读(5) 评论(0) 推荐(0)