java springmvc 数据库连接(Druid) 数据库连接字符串 idea database 连接字符串

Druid配置

applicationContext.xml


    <context:component-scan base-package="com.gx.Service"/>
    
    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8" />
        <property name="username" value="root"/>
        <property name="password" value="123456"/>
    bean>
    
    <bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
    bean>
    
    <bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="sqlSessionFactory" ref="sqlSessionFactoryBean" />
        <property name="basePackage" value="com.gx.Dao" />
    bean>

idea database 连接字符串配置

java springmvc 数据库连接(Druid) 数据库连接字符串 idea database 连接字符串_第1张图片
jdbc:mysql://localhost:3306/test?useUnicode=true&serverTimezone=UTC

你可能感兴趣的:(Java,mysql,spring)