Error creating bean with name 'requestMappingHandlerAdapter'
for me removing following from pom.xml fixed the issue
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
as i was also using
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Your cause is
nested exception is java.lang.ClassCastException: org.springframework.web.accept.ContentNegotiationManagerFactoryBean$$EnhancerByCGLIB$$88a811cb cannot be cast to org.springframework.web.accept.ContentNegotiationManager
This is probably due to both <mvc:annotation-driven />
and @EnableWebMvc
are used together. As they are not complementary, either use @EnableWebMvc
with Java based config or <mvc:annotation-driven />
with xml.
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
I received the same error. I removed the version.
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
This effectively downloaded: <javax-validation.version>2.0.1.Final</javax-validation.version> which works without the error.
In your User.java class add @javax.persistence.Id
above getUserID()
method
just like this...
@javax.persistence.Id
public int getUserID() {
return userID;
}
It worked for me.