发表于: 2018-03-06 13:33:56
1 602
今天完成:1.使用maven依赖spring的jdbctemplate编写dao层。
2.关于spring的配置以依赖的问题。
类与类之间的依赖的配置。又叫Bean的装配方式。Bean在spring中相当于类的声明帮助,当spring有apllicationContext容器之后,spring的容器就可以使用(读取)这些bean配置来生成实例。这是spring的设计模式
bean的装配方式
2.注解装配。有好几种搭配模式,xml+bean+开启注解处理器+注解,xml+context+注解,这里要导入aop jar包,
3,xml+autowire,自动装配
遇到问题:1.maven编译失败
百度得到
pom.xml文件中增加jdk的设置,类似如下
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
2.运行抛异常,找不到spring配置
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [application-beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [application-beans.xml] cannot be opened because it does not exist
原因:idea是放在resource文件夹里面。eclipse不需要
3.mysql-connetor-java版本问题
问题:用了6.0.6版本就报错。用5.1.45就没事。。为什么
评论