spring学习之路1

来源:互联网 发布:超星阅读器windows 编辑:程序博客网 时间:2024/05/24 05:08

2016年开始从事IT行业,一点点地慢慢走着,最近勤快了很多,想写点什么记住防止以后忘记!

引用原博客地址:
   http://blog.csdn.net/qq_19558705/article/details/50018469

在安装上述地址去模仿操作的时候遇到了一点问题,不过都通过度娘解决了

1、关于maven pom.xml的配置:

多加上spring的test库,用maven添加即可。

                <dependency>              <groupId>org.springframework</groupId>              <artifactId>spring-test</artifactId>              <version>${spring.version}</version>          </dependency>
2、pom.xml还必须指定编译环境,不然一直报selvet3.0需要更高的java版本的错误

    <plugins>          <!-- define the project compile level -->          <plugin>              <groupId>org.apache.maven.plugins</groupId>              <artifactId>maven-compiler-plugin</artifactId>              <version>2.3.2</version>              <configuration>                  <source>1.8</source>                  <target>1.8</target>              </configuration>          </plugin>    </plugins>  
3、在sevlet3.0以上的版本web.xml 不是必须的,可以不用添加

4、配置c3p0数据源的时候要注意的那些事儿

我的配置文件添加了 applicationContext.xml如下一些配置:

    <bean  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">        <property name="locations">            <list>               <value>classpath:db.properties</value>             </list>        </property>    </bean>
专门用来寻找我的db.properties

同时要注意:


这个配置文件注意各种不能存在空格;否则连接不上数据库,并且报找不到驱动或者类型转换的异常


1 0
原创粉丝点击