切换到4.0.1版本后,“JavaMailSenderImpl无法解析为类型”

时间:2014-02-11 19:41:28

标签: java spring maven spring-mvc build

我使用3.1.1 Framework Version开发了Spring MVC应用程序,现在我想切换到4.0.1。

我正在使用Maven来处理所有依赖项。所以当我更改pom.xml中的版本时,我得到编译错误JavaMailSenderImpl无法解析为键入。

此外,我无法在jars中找到包org.springframework.mail.javamail.JavaMailSenderImpl。但是从文档中看起来这个包在最新版本中并未删除。 我试过清理项目&再次建设,但没有帮助我。

所以我知道我在这里做错了什么?

This is the URL to docs

以下是pom.xml -

部分
    <properties>
        <hibernate.version>4.1.3.Final</hibernate.version>
        <spring.version>4.0.1.RELEASE</spring.version>
        <spring.security.core.version>3.1.1.RELEASE</spring.security.core.version>
        <spring.security.version>3.1.1.RELEASE</spring.security.version>
        <google-guava.version>12.0</google-guava.version>
        <joda-time.version>2.1</joda-time.version>
        <slf4j.version>1.6.4</slf4j.version>
        <h2.version>1.3.167</h2.version>
        <jasper.version>4.7.0</jasper.version>
        <commons.digester.version>2.1</commons.digester.version>
        <commons.collections.version>3.2.1</commons.collections.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>     
  <dependencies>

        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-webmvc</artifactId>
          <version>${spring.version}</version>
          <exclusions>
            <exclusion>
              <artifactId>commons-logging</artifactId>
              <groupId>commons-logging</groupId>
            </exclusion>
          </exclusions>
        </dependency>

        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-jdbc</artifactId>
          <version>${spring.version}</version>
        </dependency>

        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-orm</artifactId>
          <version>${spring.version}</version>
        </dependency>

        <dependency>
          <groupId>org.springframework.data</groupId>
          <artifactId>spring-data-jpa</artifactId>
          <version>1.1.0.RELEASE</version>
        </dependency>

        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-test</artifactId>
          <version>${spring.version}</version>
          <scope>test</scope>
        </dependency>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring.security.version}</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring.security.version}</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring.security.version}</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${spring.security.version}</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId> 
            <artifactId>spring-aop</artifactId>
            <version>${spring.security.core.version}</version>
        </dependency>

        <!-- Java Mail Dependency -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.7</version>
        </dependency>

        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>
</dependencies>
</project>

1 个答案:

答案 0 :(得分:17)

这是依赖,我失踪了。所以我添加了以下依赖 -

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>4.0.1.RELEASE</version>
        </dependency>