• spring 数据库mysql的配置注入方式


    <bean id="accountDao" class="org.itcruce.dao.impl.AccountDaoImpl">
    		<property name="runner" ref="runner"></property>
    	</bean>
    
    	<!-- 注入数据源 -->
    	<bean id="runner" class="org.apache.commons.dbutils.QueryRunner"
    		scope="prototype">
    		<constructor-arg name="ds" ref="dataSource"></constructor-arg>
    	</bean>
    
    	<!-- 配置数据源 -->
    	<bean id="dataSource"
    		class="com.mchange.v2.c3p0.ComboPooledDataSource">
    		<!--连接数据库的必备信息 -->
    		<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
    		<property name="jdbcUrl"
    			value="jdbc:mysql://localhost:3306/itcruce?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC"></property>
    		<property name="user" value="root"></property>
    		<property name="password" value="Password1"></property>
    	</bean>
    

      

  • 相关阅读:
    java8学习
    linux常用命令
    window操作系统分区
    java8特性
    mysql索引本质
    红黑树
    http请求传参问题解决
    老王说架构
    从URL到看到网页的过程
    RabbitMQ如何工作和RabbitMQ核心概念
  • 原文地址:https://www.cnblogs.com/KruceCoder/p/12361090.html
Copyright © 2020-2023  润新知