【Java进阶打卡】JDBC- jdbc连接池

news/2024/4/28 23:46:55/文章来源:https://blog.csdn.net/qq_44653420/article/details/128947755

【Java进阶打卡】JDBC- jdbc连接池

    • 概述
    • 自定义数据库连接池
    • 归还连接-装饰设计模式
    • 归还连接-适配器设计模式
    • 动态代理
    • 动态代理-归还数据库连接

概述

在这里插入图片描述
在这里插入图片描述

自定义数据库连接池

  • DataSource接口概述
    • javax.sql.DataSource接口:数据源(数据库连接池) Java官方提供的数据库连接池规范
    • 如果像完成数据库连接池技术,就必须实现dataSource接口
    • 核心功能:获取数据库连接对象:connection getConnection()

在这里插入图片描述

连接池接口的实现

package com.itheima01;
import com.itheima01.utils.JDBCUtils;
import javax.sql.DataSource;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;public class MyDataSource implements DataSource {// 从连接池中获取一个连接对象// 准备容器 用于保存多个连接对象  将对象设置为线程安全的对象private  static List<Connection> pool = Collections.synchronizedList(new ArrayList<>());// 将arrayList变成线程安全的对象// 定义静态代码块  通过工具类获取10个连接对象 类加载的时候 就执行该静态代码块static {for(int i = 1; i <= 10; i++){try {Connection con = JDBCUtils.getConnection();pool.add(con);// 将连接对象添加到连接池中} catch (SQLException e) {throw new RuntimeException(e);}}}//    重写getConnection 用于获取一个连接对象@Overridepublic Connection getConnection() throws SQLException {// 只要池子中还有对象  返回0索引的对象if(pool.size() > 0){Connection con = pool.remove(0);// 移除一个元素  返回该连接对象return con;}else{throw new RuntimeException("连接数量已经用尽");}}// 定义getSize方法  获取连接池容器的大小public int getSize(){return pool.size();}@Overridepublic Connection getConnection(String username, String password) throws SQLException {return null;}@Overridepublic PrintWriter getLogWriter() throws SQLException {return null;}@Overridepublic void setLogWriter(PrintWriter out) throws SQLException {}@Overridepublic void setLoginTimeout(int seconds) throws SQLException {}@Overridepublic int getLoginTimeout() throws SQLException {return 0;}@Overridepublic Logger getParentLogger() throws SQLFeatureNotSupportedException {return null;}@Overridepublic <T> T unwrap(Class<T> iface) throws SQLException {return null;}@Overridepublic boolean isWrapperFor(Class<?> iface) throws SQLException {return false;}
}

连接池接口的测试

package com.itheima01;import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;public class MyDataSourceTest {public static void main(String[] args) throws SQLException {// 创建连接池对象MyDataSource m = new MyDataSource();// 使用之前的数量System.out.println("使用之前的数量:" + m.getSize());// 通过连接池对象 获取对象Connection con = m.getConnection();// 查询学生表的全部信息String sql = "SELECT * FROM student";// 创建执行者对象 防止SQL攻击PreparedStatement preparedStatement = con.prepareStatement(sql);// 执行sql语句 接收结果集ResultSet resultSet = preparedStatement.executeQuery();// 处理结果集while(resultSet.next()){// 打印学生信息System.out.println(resultSet.getInt("sid") + "\t" + resultSet.getString("name") + "\t" + resultSet.getInt("age") + "\t" + resultSet.getDate("birthday"));}// 释放资源con.close();preparedStatement.close();resultSet.close();// 使用之后的连接池对象数量System.out.println("使用之后的连接池的数量:" + m.getSize());}
}

归还连接-装饰设计模式

在这里插入图片描述

  • 自定义连接对象
package com.itheima01;
import java.sql.*;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;// 定义一个类 实现Connection接口
// 定义连接对象和连接池容器对象的成员变量
// 通过有参构造方法为成员变量进行赋值
// 重写close方法 完成归还连接
// 剩余方法 还是调用原有的连接对象中的功能即可
public class MyConnection1 implements Connection {// 定义连接对象和连接池容器对象的成员变量private Connection con;// 连接对象private List<Connection> pool;// 连接池对象// 通过有参构造方法为成员变量进行赋值public MyConnection1(Connection con,List<Connection> pool){this.con = con;this.pool = pool;}// 重写close方法  完成归还连接@Overridepublic void close(){pool.add(con);// 将连接对象添加到连接池中}// 剩余方法 还是调用原来的的连接对象中的功能即可@Overridepublic Statement createStatement() throws SQLException {return con.createStatement();}@Overridepublic PreparedStatement prepareStatement(String sql) throws SQLException {return con.prepareStatement(sql);}@Overridepublic CallableStatement prepareCall(String sql) throws SQLException {return con.prepareCall(sql);}@Overridepublic String nativeSQL(String sql) throws SQLException {return con.nativeSQL(sql);}@Overridepublic void setAutoCommit(boolean autoCommit) throws SQLException {con.setAutoCommit(autoCommit);}@Overridepublic boolean getAutoCommit() throws SQLException {return con.getAutoCommit();}@Overridepublic void commit() throws SQLException {con.commit();}@Overridepublic void rollback() throws SQLException {con.rollback();}@Overridepublic boolean isClosed() throws SQLException {return con.isClosed();}@Overridepublic DatabaseMetaData getMetaData() throws SQLException {return con.getMetaData();}@Overridepublic void setReadOnly(boolean readOnly) throws SQLException {con.setReadOnly(readOnly);}@Overridepublic boolean isReadOnly() throws SQLException {return con.isReadOnly();}@Overridepublic void setCatalog(String catalog) throws SQLException {con.setCatalog(catalog);}@Overridepublic String getCatalog() throws SQLException {return con.getCatalog();}@Overridepublic void setTransactionIsolation(int level) throws SQLException {con.setTransactionIsolation(level);}@Overridepublic int getTransactionIsolation() throws SQLException {return con.getTransactionIsolation();}@Overridepublic SQLWarning getWarnings() throws SQLException {return con.getWarnings();}@Overridepublic void clearWarnings() throws SQLException {con.clearWarnings();}@Overridepublic Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {return con.createStatement(resultSetType,resultSetConcurrency);}@Overridepublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {return con.prepareStatement(sql,resultSetType,resultSetConcurrency);}@Overridepublic CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {return con.prepareCall(sql,resultSetType,resultSetConcurrency);}@Overridepublic Map<String, Class<?>> getTypeMap() throws SQLException {return con.getTypeMap();}@Overridepublic void setTypeMap(Map<String, Class<?>> map) throws SQLException {con.setTypeMap(map);}@Overridepublic void setHoldability(int holdability) throws SQLException {con.setHoldability(holdability);}@Overridepublic int getHoldability() throws SQLException {return con.getHoldability();}@Overridepublic Savepoint setSavepoint() throws SQLException {return con.setSavepoint();}@Overridepublic Savepoint setSavepoint(String name) throws SQLException {return con.setSavepoint(name);}@Overridepublic void rollback(Savepoint savepoint) throws SQLException {con.rollback(savepoint);}@Overridepublic void releaseSavepoint(Savepoint savepoint) throws SQLException {con.releaseSavepoint(savepoint);}@Overridepublic Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {return con.createStatement(resultSetType,resultSetConcurrency,resultSetHoldability);}@Overridepublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {return con.prepareStatement(sql,resultSetType,resultSetConcurrency,resultSetHoldability);}@Overridepublic CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {return con.prepareCall(sql,resultSetType,resultSetConcurrency,resultSetHoldability);}@Overridepublic PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {return con.prepareStatement(sql,autoGeneratedKeys);}@Overridepublic PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {return con.prepareStatement(sql,columnIndexes);}@Overridepublic PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {return con.prepareStatement(sql,columnNames);}@Overridepublic Clob createClob() throws SQLException {return con.createClob();}@Overridepublic Blob createBlob() throws SQLException {return con.createBlob();}@Overridepublic NClob createNClob() throws SQLException {return con.createNClob();}@Overridepublic SQLXML createSQLXML() throws SQLException {return con.createSQLXML();}@Overridepublic boolean isValid(int timeout) throws SQLException {return con.isValid(timeout);}@Overridepublic void setClientInfo(String name, String value) throws SQLClientInfoException {con.setClientInfo(name,value);}@Overridepublic void setClientInfo(Properties properties) throws SQLClientInfoException {con.setClientInfo(properties);}@Overridepublic String getClientInfo(String name) throws SQLException {return con.getClientInfo(name);}@Overridepublic Properties getClientInfo() throws SQLException {return con.getClientInfo();}@Overridepublic Array createArrayOf(String typeName, Object[] elements) throws SQLException {return con.createArrayOf(typeName,elements);}@Overridepublic Struct createStruct(String typeName, Object[] attributes) throws SQLException {return con.createStruct(typeName,attributes);}@Overridepublic void setSchema(String schema) throws SQLException {con.setSchema(schema);}@Overridepublic String getSchema() throws SQLException {return con.getSchema();}@Overridepublic void abort(Executor executor) throws SQLException {con.abort(executor);}@Overridepublic void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {con.setNetworkTimeout(executor,milliseconds);}@Overridepublic int getNetworkTimeout() throws SQLException {return con.getNetworkTimeout();}@Overridepublic <T> T unwrap(Class<T> iface) throws SQLException {return con.unwrap(iface);}@Overridepublic boolean isWrapperFor(Class<?> iface) throws SQLException {return con.isWrapperFor(iface);}
}
  • 自定义DataSource
package com.itheima01;
import com.itheima01.utils.JDBCUtils;
import javax.sql.DataSource;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;public class MyDataSource implements DataSource {// 从连接池中获取一个连接对象// 准备容器 用于保存多个连接对象  将对象设置为线程安全的对象private  static List<Connection> pool = Collections.synchronizedList(new ArrayList<>());// 将arrayList变成线程安全的对象// 定义静态代码块  通过工具类获取10个连接对象 类加载的时候 就执行该静态代码块static {for(int i = 1; i <= 10; i++){try {Connection con = JDBCUtils.getConnection();pool.add(con);// 将连接对象添加到连接池中} catch (SQLException e) {throw new RuntimeException(e);}}}//    重写getConnection 用于获取一个连接对象@Overridepublic Connection getConnection() throws SQLException {// 只要池子中还有对象  返回0索引的对象if(pool.size() > 0){Connection con = pool.remove(0);// 移除一个元素  返回该连接对象// 创建自定义连接对象  对原有的连接对象进行包装  主要是为了使用归还资源的方法MyConnection1 myCon = new MyConnection1(con,pool);return myCon;}else{throw new RuntimeException("连接数量已经用尽");}}// 定义getSize方法  获取连接池容器的大小public int getSize(){return pool.size();}@Overridepublic Connection getConnection(String username, String password) throws SQLException {return null;}@Overridepublic PrintWriter getLogWriter() throws SQLException {return null;}@Overridepublic void setLogWriter(PrintWriter out) throws SQLException {}@Overridepublic void setLoginTimeout(int seconds) throws SQLException {}@Overridepublic int getLoginTimeout() throws SQLException {return 0;}@Overridepublic Logger getParentLogger() throws SQLFeatureNotSupportedException {return null;}@Overridepublic <T> T unwrap(Class<T> iface) throws SQLException {return null;}@Overridepublic boolean isWrapperFor(Class<?> iface) throws SQLException {return false;}
}

归还连接-适配器设计模式

在这里插入图片描述

  • MyAdapter
package com.itheima01;import java.sql.*;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;// 定义一个适配器类 实现connection接口  没有重写close方法
// 抽象类 既可以有普通方法 抽象方法 也可以有构造方法 私有成员变量
public abstract class MyAdapter implements Connection {// 定义连接对象的成员变量private Connection con;// 通过有参构造为变量进行赋值public MyAdapter(Connection con){this.con = con;}@Overridepublic Statement createStatement() throws SQLException {return con.createStatement();}@Overridepublic PreparedStatement prepareStatement(String sql) throws SQLException {return con.prepareStatement(sql);}@Overridepublic CallableStatement prepareCall(String sql) throws SQLException {return con.prepareCall(sql);}@Overridepublic String nativeSQL(String sql) throws SQLException {return con.nativeSQL(sql);}@Overridepublic void setAutoCommit(boolean autoCommit) throws SQLException {con.setAutoCommit(autoCommit);}@Overridepublic boolean getAutoCommit() throws SQLException {return con.getAutoCommit();}@Overridepublic void commit() throws SQLException {con.commit();}@Overridepublic void rollback() throws SQLException {con.rollback();}@Overridepublic boolean isClosed() throws SQLException {return con.isClosed();}@Overridepublic DatabaseMetaData getMetaData() throws SQLException {return con.getMetaData();}@Overridepublic void setReadOnly(boolean readOnly) throws SQLException {con.setReadOnly(readOnly);}@Overridepublic boolean isReadOnly() throws SQLException {return con.isReadOnly();}@Overridepublic void setCatalog(String catalog) throws SQLException {con.setCatalog(catalog);}@Overridepublic String getCatalog() throws SQLException {return con.getCatalog();}@Overridepublic void setTransactionIsolation(int level) throws SQLException {con.setTransactionIsolation(level);}@Overridepublic int getTransactionIsolation() throws SQLException {return con.getTransactionIsolation();}@Overridepublic SQLWarning getWarnings() throws SQLException {return con.getWarnings();}@Overridepublic void clearWarnings() throws SQLException {con.clearWarnings();}@Overridepublic Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {return con.createStatement(resultSetType,resultSetConcurrency);}@Overridepublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {return con.prepareStatement(sql,resultSetType,resultSetConcurrency);}@Overridepublic CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {return con.prepareCall(sql,resultSetType,resultSetConcurrency);}@Overridepublic Map<String, Class<?>> getTypeMap() throws SQLException {return con.getTypeMap();}@Overridepublic void setTypeMap(Map<String, Class<?>> map) throws SQLException {con.setTypeMap(map);}@Overridepublic void setHoldability(int holdability) throws SQLException {con.setHoldability(holdability);}@Overridepublic int getHoldability() throws SQLException {return con.getHoldability();}@Overridepublic Savepoint setSavepoint() throws SQLException {return con.setSavepoint();}@Overridepublic Savepoint setSavepoint(String name) throws SQLException {return con.setSavepoint(name);}@Overridepublic void rollback(Savepoint savepoint) throws SQLException {con.rollback(savepoint);}@Overridepublic void releaseSavepoint(Savepoint savepoint) throws SQLException {con.releaseSavepoint(savepoint);}@Overridepublic Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {return con.createStatement(resultSetType,resultSetConcurrency,resultSetHoldability);}@Overridepublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {return con.prepareStatement(sql,resultSetType,resultSetConcurrency,resultSetHoldability);}@Overridepublic CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {return con.prepareCall(sql,resultSetType,resultSetConcurrency,resultSetHoldability);}@Overridepublic PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {return con.prepareStatement(sql,autoGeneratedKeys);}@Overridepublic PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {return con.prepareStatement(sql,columnIndexes);}@Overridepublic PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {return con.prepareStatement(sql,columnNames);}@Overridepublic Clob createClob() throws SQLException {return con.createClob();}@Overridepublic Blob createBlob() throws SQLException {return con.createBlob();}@Overridepublic NClob createNClob() throws SQLException {return con.createNClob();}@Overridepublic SQLXML createSQLXML() throws SQLException {return con.createSQLXML();}@Overridepublic boolean isValid(int timeout) throws SQLException {return con.isValid(timeout);}@Overridepublic void setClientInfo(String name, String value) throws SQLClientInfoException {con.setClientInfo(name,value);}@Overridepublic void setClientInfo(Properties properties) throws SQLClientInfoException {con.setClientInfo(properties);}@Overridepublic String getClientInfo(String name) throws SQLException {return con.getClientInfo(name);}@Overridepublic Properties getClientInfo() throws SQLException {return con.getClientInfo();}@Overridepublic Array createArrayOf(String typeName, Object[] elements) throws SQLException {return con.createArrayOf(typeName,elements);}@Overridepublic Struct createStruct(String typeName, Object[] attributes) throws SQLException {return con.createStruct(typeName,attributes);}@Overridepublic void setSchema(String schema) throws SQLException {con.setSchema(schema);}@Overridepublic String getSchema() throws SQLException {return con.getSchema();}@Overridepublic void abort(Executor executor) throws SQLException {con.abort(executor);}@Overridepublic void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {con.setNetworkTimeout(executor,milliseconds);}@Overridepublic int getNetworkTimeout() throws SQLException {return con.getNetworkTimeout();}@Overridepublic <T> T unwrap(Class<T> iface) throws SQLException {return con.unwrap(iface);}@Overridepublic boolean isWrapperFor(Class<?> iface) throws SQLException {return con.isWrapperFor(iface);}
}
  • MyConnection2
package com.itheima01;import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;//定义一个类  继承适配器类
public class MyConnection2 extends MyAdapter{// 定义连接对象和连接池容器对象的成员变量private Connection con;// 连接对象private List<Connection> pool;// 连接池对象// 通过有参构造为变量进行赋值public MyConnection2(Connection con,List<Connection> pool){super(con);this.con = con;this.pool = pool;}@Overridepublic void close() throws SQLException {pool.add(con);// 添加连接对象}
}
  • MyDataSource
package com.itheima01;
import com.itheima01.utils.JDBCUtils;
import javax.sql.DataSource;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;public class MyDataSource implements DataSource {// 从连接池中获取一个连接对象// 准备容器 用于保存多个连接对象  将对象设置为线程安全的对象private  static List<Connection> pool = Collections.synchronizedList(new ArrayList<>());// 将arrayList变成线程安全的对象// 定义静态代码块  通过工具类获取10个连接对象 类加载的时候 就执行该静态代码块static {for(int i = 1; i <= 10; i++){try {Connection con = JDBCUtils.getConnection();pool.add(con);// 将连接对象添加到连接池中} catch (SQLException e) {throw new RuntimeException(e);}}}//    重写getConnection 用于获取一个连接对象@Overridepublic Connection getConnection() throws SQLException {// 只要池子中还有对象  返回0索引的对象if(pool.size() > 0){Connection con = pool.remove(0);// 移除一个元素  返回该连接对象// 创建自定义连接对象  对原有的连接对象进行包装  主要是为了使用归还资源的方法MyConnection2 myCon = new MyConnection2(con,pool);return myCon;}else{throw new RuntimeException("连接数量已经用尽");}}// 定义getSize方法  获取连接池容器的大小public int getSize(){return pool.size();}@Overridepublic Connection getConnection(String username, String password) throws SQLException {return null;}@Overridepublic PrintWriter getLogWriter() throws SQLException {return null;}@Overridepublic void setLogWriter(PrintWriter out) throws SQLException {}@Overridepublic void setLoginTimeout(int seconds) throws SQLException {}@Overridepublic int getLoginTimeout() throws SQLException {return 0;}@Overridepublic Logger getParentLogger() throws SQLFeatureNotSupportedException {return null;}@Overridepublic <T> T unwrap(Class<T> iface) throws SQLException {return null;}@Overridepublic boolean isWrapperFor(Class<?> iface) throws SQLException {return false;}
}

动态代理

  • 动态代理:在不改变目标对象方法的情况下对方法进行增强
  • 组成:被代理对象:真实的对象 代理对象:内存中的一个对象
  • 要求:代理对象必须和被代理对象实现相同的接口
  • 实现:Proxy.newProxyInstance()

package com.itheima02;import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;public class Test {public static void main(String[] args) {Student stu = new Student();
//        stu.eat("米饭");
//        stu.study();//        类加载器:和被代理对象使用相同的类加载器
//        接口类型的数组:和被代理对象使用相同的接口
//        代理的规则:完成代理增强的功能StudentInterface proxyStu = (StudentInterface) Proxy.newProxyInstance(stu.getClass().getClassLoader(), new Class[]{StudentInterface.class}, new InvocationHandler() {@Overridepublic Object invoke(Object proxy, Method method, Object[] args) throws Throwable {if(method.getName().equals("study")){System.out.println("学习");return null;}else {return method.invoke(stu,args);}}});proxyStu.eat("米饭");proxyStu.study();}
}

动态代理-归还数据库连接

在这里插入图片描述

    public Connection getConnection() throws SQLException {// 只要池子中还有对象  返回0索引的对象if(pool.size() > 0){Connection con = pool.remove(0);// 移除一个元素  返回该连接对象Connection proxy = (Connection) Proxy.newProxyInstance(con.getClass().getClassLoader(), new Class[]{Connection.class}, new InvocationHandler() {// 执行Connection实现类连接对象所有的方法都会经过invoke// 如果是close方法 归还链接// 如果不是 直接执行连接对象原有的功能即可@Overridepublic Object invoke(Object proxy, Method method, Object[] args) throws Throwable {if(method.getName().equals("close")){// 归还连接pool.add(con);return null;}else{return method.invoke(con,args);}}});return proxy;}else{throw new RuntimeException("连接数量已经用尽");}}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_255647.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

LaoCat带你认识容器与镜像(实践篇二上)

实践篇主要以各容器的挂载和附加命令为主。 本章内容 本文实操全部基于Ubuntu 20.04 宿主机 > linux服务器本身 Docker > 20.10.22 在开始本章内容之前&#xff0c;我解答一个问题&#xff0c;有小伙伴问我说&#xff0c;有的容器DockerHub官网并没有提供任何可参考的文…

软件测试标准流程

软件测试的基本流程大概要经历四个阶段&#xff0c;分别是制定测试计划、测试需求分析、测试用例设计与编写以及测试用例评审。因此软件测试的工作内容&#xff0c;远远没有许多人想象的只是找出bug那么简单。准确的说&#xff0c;从一个项目立项以后&#xff0c;软件测试从业者…

【项目精选】基于Java的敬老院管理系统的设计和实现

本系统主要是针对敬老院工作人员即管理员和员工设计的。敬老院管理系统 将IT技术为养老院提供一个接口便于管理信息,存储老人个人信息和其他信息,查找 和更新信息的养老院档案,节省了员工的劳动时间,大大降低了成本。 其主要功能包括&#xff1a; 系统管理员用户功能介绍&#…

面临激烈竞争的汽车之家仍有新的增长机会

来源&#xff1a;猛兽财经 作者&#xff1a;猛兽财经 竞争激烈是汽车之家面临的主要问题 在汽车之家&#xff08;ATHM&#xff09;2021财年的20-F文件中&#xff0c;汽车之家将自己描述为中国最大的“汽车服务平台”运营商&#xff0c;但行业数据却显示&#xff0c;汽车之家的…

Python 如何快速搭建环境?

Python可应用于多平台包括 Linux 和 Mac OS X。 你可以通过终端窗口输入 “python” 命令来查看本地是否已经安装Python以及Python的安装版本。 Unix (Solaris, Linux, FreeBSD, AIX, HP/UX, SunOS, IRIX, 等等。) Win 9x/NT/2000 Macintosh (Intel, PPC, 68K) OS/2 DOS (多个…

10条终身受益的Salesforce职业发展建议!

Salesforce这个千亿美金巨兽&#xff0c;在全球范围内有42,000多名员工。作为一家发展迅速的科技公司&#xff0c;一直在招聘各种角色&#xff0c;包括销售、营销、工程师和管理人员等。 据IDC估计&#xff0c;从2016年到2020年&#xff0c;该生态系统创造了190万个工作岗位。…

训练营day16

104.二叉树的最大深度 559.n叉树的最大深度111.二叉树的最小深度222.完全二叉树的节点个数104.二叉树的最大深度 力扣题目链接 给定一个二叉树&#xff0c;找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 说明: 叶子节点是指没有子节点的节点。 示…

Java基础-网络编程

1. 网络编程入门 1.1 网络编程概述 计算机网络 是指将地理位置不同的具有独立功能的多台计算机及其外部设备&#xff0c;通过通信线路连接起来&#xff0c;在网络操作系统&#xff0c;网络管理软件及网络通信协议的管理和协调下&#xff0c;实现资源共享和信息传递的计算机系统…

Vue中路由缓存及activated与deactivated的详解

目录前言一&#xff0c;路由缓存1.1 引子1.2 路由缓存的方法1.2.1 keep-alive1.2.2 keep-alive标签中的include属性1.2.3 include中多组件的配置二&#xff0c;activated与deactivated2.1 引子2.2 介绍activated与deactivated2.3 解决需求三&#xff0c;整体代码总结前言 在Vu…

【深度学习基础8】卷积神经网络 经典网络

一、卷积操作 1. 基本原理 相信大家对卷积操作并不陌生,先来回顾一下卷积的工作原理(2-D):👇 卷积的目的是进行特征提取,不同的卷积核可以提取到不同的特征,比如下面的三个卷积核的功能分别是:模糊化、锐化、边缘化👇 卷积的本质就是滤波器, 将滤波器沿着图像…

【JavaScript】面向对象和构造函数详解

&#x1f4bb; 【JavaScript】面向对象和构造函数详解 &#x1f3e0;专栏&#xff1a;JavaScript &#x1f440;个人主页&#xff1a;繁星学编程&#x1f341; &#x1f9d1;个人简介&#xff1a;一个不断提高自我的平凡人&#x1f680; &#x1f50a;分享方向&#xff1a;目前…

加拿大访问学者家属如何办理探亲签证?

由于大多数访问学者的访学期限都为一年&#xff0c;家人来访不仅可以缓解访学的寂寞生活&#xff0c;而且也是家人到加拿大体验国外风情的好机会。家属在国内申请赴加签证时&#xff0c;如果材料齐全&#xff0c;一般上午递交了申请&#xff0c;下午就可以拿到签证。以下是家人…

基于merlin使用chatGPT进行对话

最近chatGPT很热&#xff0c;大家都想试用它。但由于各种限制&#xff0c;一般情况下国内不能试用。 下面给大家介绍基于merlin使用chatGPT&#xff08;目前每天只有11次问答次数&#xff09;。 1 打开merlin页面 访问地址merlin.foyer.work&#xff0c;点击“add to chrome”…

流程控制之循环

文章目录五、流程控制之循环5.1 步进循环语句for5.1.1 带列表的for循环语句5.1.2 不带列表的for循环语句5.1.3 类C风格的for循环语句5.2 while循环语句5.2.1 while循环读取文件5.2.2 while循环语句示例5.3 until循环语句5.4 select循环语句5.5 嵌套循环5.4 利用break和continue…

Elasticsearch安装IK分词器、配置自定义分词词库

一、分词简介 在Elasticsearch中&#xff0c;假设搜索条件是“华为手机平板电脑”&#xff0c;要求是只要满足了其中任意一个词语组合的数据都要查询出来。借助 Elasticseach 的文本分析功能可以轻松将搜索条件进行分词处理&#xff0c;再结合倒排索引实现快速检索。Elasticse…

crawler爬虫抓取数据

crawler爬虫实现 学习目标&#xff1a; 了解 crawler爬虫运行流程了解 crawler爬虫模块实现 1. crawler功能 初始化driver输入公司名称,并点击判断是否需要验证如果需要验证&#xff0c;获取验证图片并保存获取打码坐标点击验证图片判断查询结果选择第一条查询结果获取主要信…

Vue2仿网易云风格音乐播放器(附源码)

Vue2仿网易云风格音乐播放器1、整体效果2、使用技术3、实现内容4、源码5、使用图片1、整体效果 2、使用技术 使用了HTML5 CSS3进行页面布局及美化使用Vue2进行数据渲染与页面交互使用Axios发送http请求获取数据 3、实现内容 实现了搜索歌曲功能&#xff0c;输入歌手或歌曲关…

2023年做跨境电商的4个小忠告

2023年做跨境电商的小伙伴日益增加&#xff0c;但不管是对于新手还是老人&#xff0c;都是一个极具挑战的事情&#xff0c;因为做好跨境电商不是一件容易的事情&#xff0c;需要花费不少时间与精力。这里我们小编就给大家几个小忠告&#xff0c;希望对大家有用。2023年做跨境电…

私募证券基金动态-23年1月报

成交量&#xff1a;1月日均7,901.31亿元2023年1月A股两市日均成交7,901.31亿元&#xff0c;环比上升0.33%、同比下降25.18%。1月恰逢春节仅16个交易日&#xff0c;节后2个交易日交易量明显回暖。管理人&#xff1a;新提交备案51家&#xff0c;备案通过21家1月新提交备案申请的5…

侯捷C++系统工程师

前言我相信对于每一个学习C的同学和从业者来说&#xff0c;台湾著名学者侯捷老师的C系列都是不可错过的好视频。侯捷老师在网上已有五门课&#xff0c;分别是&#xff1a;C面向对象开发、STL标准库与泛型编程、C新标准C1&14、C内存管理机制以及C Startup揭秘讲师介绍侯捷老…