- 博客(8)
- 收藏
- 关注
原创 spring boot 配置跨域
1.yml中配置参数cors: origins: [http://localhost:8087] credentials: true methods: [GET,POST,PUT,DELET,OPTIONS] heads: [] exposeHeaders: [user_token]2.properties对象@Configuration@ConfigurationProperties(prefix = "cors")public class CorsProperties {
2022-04-21 23:27:56
585
2
原创 Apache——DBUtils
public class BasicDao<T> { private static QueryRunner queryRunner; static { queryRunner = new QueryRunner(); } //返回结果集(ArrayList集合) public List<T> queryResultSet(String sql, Class<T> clazz, Object... paramet
2021-12-24 19:11:20
690
1
原创 JDBC连接池——druid
public class JDBCUtilsByDruid { private JDBCUtilsByDruid(){} private static DataSource dataSource; static { Properties properties = new Properties(); try { properties.load(new FileInputStream("src\\druid.propertie
2021-12-24 19:09:58
170
原创 sql批处理
配置文件中url后加?rewriteBatchedStatements=true@Test public void test01() { Connection connection = JDBCUtils.getConnection(); String sql = "insert into actor values(null ,? ,?)"; PreparedStatement preparedStatement = null; tr
2021-12-23 21:48:22
1020
原创 druid连接池
https://repo1.maven.org/maven2/com/alibaba/druid/1.1.10/@Test public void test01() throws Exception { Properties properties = new Properties(); properties.load(new FileInputStream("src\\druid.properties")); DataSource dataSourc
2021-12-22 19:34:22
630
原创 JDBCUtils
/** * jdbc工具类 */public class JDBCUtils { private static String user; private static String password; private static String url; private static String driver; static { Properties properties = new Properties(); try {.
2021-12-22 19:13:57
101
原创 idea连接数据库02-preparedStatement解决SQL注入
public void test01() throws Exception {//DQL Properties properties = new Properties(); properties.load(new FileInputStream("src\\mysql.properties")); String url = properties.getProperty("url"); //加载driver Class....
2021-12-21 20:44:17
829
原创 idea连接数据库01
在这里插package com.myjabc.practice_01;import com.mysql.cj.jdbc.Driver;import org.junit.Test;import java.io.FileInputStream;import java.io.IOException;import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;import java.sql
2021-12-21 10:47:16
356
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅