AssertionFailedError: expected: <null> but was: <{"timestamp"","status":500,"error":"Internal Server Error","message":"No qualifying bean of type 'org.modelmapper.ModelMapper'

AssertionFailedError: expected: but was: <{“timestamp”:“2020-07-20T19:03:43.180+0000”,“status”:500,“error”:“Internal Server Error”,“message”:“No qualifying bean of type ‘org.modelmapper.ModelMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}”,“path”:"/quiz/1"}

Hi @jeevandeep This error means the application is trying to inject a dependency, which is not previously initialized…

Usually there are two ways to define a spring managed object.

  1. Using spring stereotype annotations like @Controller @Service @Repository etc.
  2. Creating as @Bean.

In your case, Model Mapper is not a spring stereotype, this you will need to create a bean using @Bean.

Look for examples of @Bean over internet, and you will get the answer. Or looks for the references of ModelMapper in Qeats application itself!

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.

Re-opening this topic as the previously accepted solution was just Un-marked.

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.