ssm框架mysql数据库报错,jdbc.properties数据库配置问题

来源:互联网 发布:火影忍者ol先攻的算法 编辑:程序博客网 时间:2024/05/21 22:32

错误:

[main] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@50e433c3]

或者

Access denied for user 'Administrator'@'localhost' (using password: YES)

可能的问题有两个,第一个是加载的时候还没有加载数据库配置,就先初始化sqlSessionFactory,使用sqlSessionFactoryBeanName,传入的只是名字,非bean,所以不会引发提前初始化问题。

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">        <!--注入SqlSessionFactory-->        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>        <!-- 给出需要扫描的Dao接口-->        <property name="basePackage" value="org.main.dao"/>    </bean>

第二个是username这个属性被系统的username覆盖,所以它会报错,建议改为其他变量名,比如user

driver=com.mysql.jdbc.Driverurl=jdbc:mysql://127.0.0.1:3306/seckill?useUnicode=true&characterEncoding=utf8username=rootpassword=root
阅读全文
0 0
原创粉丝点击