环境:jdk8、sprin3.0.6、ibatis、maven
org.springframework 3.0.6.RELEASE 升级至 5.2.19.RELEASE
org.springframework.security3.0.7.RELEASE 升级至 5.2.15.RELEASE
ClassNotFoundException: org.springframework.orm.ibatis.SqlMapClientTemplate
spring升级到4.x后,orm包里面移除了对ibatis的支持
<dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatis-2-springartifactId>
<version>1.0.1version>
dependency>
nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.view.json.MappingJacksonJsonView] for bean with name 'org.springframework.web.servlet.view.json.MappingJacksonJsonView#1a8e5f95' defined in class path resource [springmvc-servlet.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.view.json.MappingJacksonJsonView
spring升级到4.x之后处理JSON的类不再是 MappingJacksonJsonView
spring4.x以下版本处理“将ModelAndView里的数据变成JSON”的类
org.springframework.web.servlet.view.json.MappingJacksonJsonView
spring4.x以上版本处理“将ModelAndView里的数据变成JSON”的类
org.springframework.web.servlet.view.json.MappingJackson2JsonView
Caused by: java.lang.AbstractMethodError: org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider;
hibernate-validator 4.3.0.Final版本校验框架是JSR-303,而Hibernate validator 5.1.0.Final版本校验框架是JSR-349,spring-context-5.0.X.RELEASE.jar框架采用新的校验框架JSR-349。
<dependency>
<groupId>org.hibernategroupId>
<artifactId>hibernate-validatorartifactId>
<version>4.1.0.Finalversion>
dependency>
<dependency>
<groupId>javax.validationgroupId>
<artifactId>validation-apiartifactId>
<version>1.0.0.GAversion>
dependency>
<dependency>
<groupId>org.hibernategroupId>
<artifactId>hibernate-validatorartifactId>
<version>6.1.0.Finalversion>
dependency>
Could not load com/fasterxml/jackson/core/JsonGenerator
<dependency>
<groupId>org.codehaus.jacksongroupId>
<artifactId>jackson-jaxrsartifactId>
<version>1.5.2version>
dependency>
<dependency>
<groupId>org.codehaus.jacksongroupId>
<artifactId>jackson-mapper-aslartifactId>
<version>1.5.2version>
dependency>
<dependency>
<groupId>org.codehaus.jacksongroupId>
<artifactId>jackson-core-aslartifactId>
<version>1.5.2version>
dependency>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-coreartifactId>
<version>2.9.8version>
dependency>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-databindartifactId>
<version>2.9.8version>
dependency>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-annotationsartifactId>
<version>2.9.8version>
dependency>
废弃的 org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter
最新使用 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
nested exception is java.lang.NoClassDefFoundError: org/hibernate/validator/resourceloading/ResourceBundleLocator
spring3.x配置
<mvc:annotation-driven validator="validator"/>
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" >
<property name="messageInterpolator" ref="messageInterpolator"/>
bean>
<bean id="messageInterpolator" class="org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator" >
<constructor-arg ref="resourceBundleLocator">constructor-arg>
bean>
<bean id="resourceBundleLocator" class="cn.org.rapid_framework.beanvalidation.MessageSourceResourceBundleLocator">
<property name="messageSource" ref="messageSource"/>
bean>
spring5.x配置
<mvc:annotation-driven validator="validator"/>
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
@Configuration
public class MyConfig {
@Bean("validator")
public Validator LocalValidator(){
return new LocalValidatorFactoryBean();
}
}