作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我用3.1.1框架版本开发了Spring MVC应用,现在我想切换到4.0.1。
我正在使用 Maven 来处理所有依赖项。因此,当我更改 pom.xml
中的版本时,出现编译错误 JavaMailSenderImpl
could not be resolved to type。
此外,我无法在 jars 中找到包 org.springframework.mail.javamail.JavaMailSenderImpl
。但是从文档看来,这个包在最新版本中没有被删除。我尝试再次清理项目和建筑,但没有帮助我。
那么知道我在这里做错了什么吗?
下面是 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>
最佳答案
这是依赖,我错过了。所以我添加了以下依赖 -
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.0.1.RELEASE</version>
</dependency>
关于java - 切换到 4.0.1 版本后 "JavaMailSenderImpl cannot be resolved to a type",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21711462/
我是一名优秀的程序员,十分优秀!