Maven 使用dependencyManagement 元素来提供了一种管理依赖版本号的方式。通常会在一个组织或者项目的最顶层的父POM 中看到dependencyManagement 元素。
使用pom.xml 中的dependencyManagement 元素能让所有在子项目中引用一个依赖而不用显式的列出版本号。Maven 会沿着父子层次向上走,直到找到一个拥有dependencyManagement 元素的项目,然后它就会使用在这个dependencyManagement 元素中指定的版本号,在子项目里就可以添加mysql-connector时可以不指定版本号,相对于dependencyManagement,所有声明在dependencies里的依赖都会自动引入,并默认被所有的子项目继承。而真正的引入在dependency元素中进行。
string-mvc.xml配置标签解释
1) context:component-scan:配置这个标签,spring就会去自动扫描对应路径或该路径的子包下面的文件,如果扫描到文件中带有@Service,@Component,@Repository,@Controller等这些注解的类,则把这些类注册为bean类。
2) Mapping/Adapter:配置映射处理和适配器
3) ViewResolver:视图解析器
4) prefix/suffix:视图解析器前缀和后缀
applicationContext.xml配置标签解释
1) context:property-placeholder location:参数配置文件的位置
2) <bean id=“datasource" class=...>
<property name=... value=.../>
...
</bean>
为spring配置的bean的各种属性设置值
3) <bean id=“sqlSessionFactory" class=...>
<property name=... value=.../>
...
</bean>
配置mybatis工厂,将数据库连接池注入
4) <bean class=mapper...>
<property name=... value="dao包"/>
...
</bean>
配置扫描Dao接口包,实现Dao接口
5) <bean id="transactionManager" class="...">
<property name="..." ref="..."/>
</bean>
配置事务管理器
UserMapper.xml
1) <select id="..." resultType="...">
sql语句
</select>以及其他操作语句
映射器(Mapper)元素,帮助我们从数据库中读取数据,把结果集组装成我们需要的对象,需要注意每个元素的参数不一样。
pom.xml
1)<groupId>: