title: @Convert in Hibernate not working with spring 4,java.lang.NoSuchMethodError: org.hibernate.cfg.Configuration.addAttributeConverter(Ljava/lang/Class;)V
body: <pre><code>&lt;project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.aratan.myapp&lt;/groupId&gt;
  &lt;artifactId&gt;reporting-module&lt;/artifactId&gt;
  &lt;version&gt;A1&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  
  &lt;build&gt;
      &lt;finalName&gt;reporting-module&lt;/finalName&gt;
      &lt;plugins&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;!-- or whatever version you use --&gt;
                  &lt;source&gt;1.8&lt;/source&gt;
                  &lt;target&gt;1.8&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.3&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;copy&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;artifactItems&gt;
                              &lt;artifactItem&gt;
                                  &lt;groupId&gt;com.github.jsimone&lt;/groupId&gt;
                                  &lt;artifactId&gt;webapp-runner&lt;/artifactId&gt;
                                  &lt;version&gt;8.0.30.2&lt;/version&gt;
                                  &lt;destFileName&gt;webapp-runner.jar&lt;/destFileName&gt;
                              &lt;/artifactItem&gt;
                          &lt;/artifactItems&gt;
  
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  
  
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.2&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;path&gt;/reporting-module&lt;/path&gt;
                  &lt;!--&lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;--&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;properties&gt;
      &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
      &lt;!-- Generic properties --&gt;
      &lt;java.version&gt;1.7&lt;/java.version&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
  
      &lt;!-- Web --&gt;
      &lt;jsp.version&gt;2.2&lt;/jsp.version&gt;
      &lt;jstl.version&gt;1.2&lt;/jstl.version&gt;
      &lt;servlet.version&gt;3.0&lt;/servlet.version&gt;
      &lt;tomcat.version&gt;7.0.57&lt;/tomcat.version&gt;
      &lt;!--&lt;tomcat.version&gt;8.0.30&lt;/tomcat.version&gt;--&gt;
  
      &lt;!-- Spring --&gt;
      &lt;org.springframework.version&gt;4.1.4.RELEASE&lt;/org.springframework.version&gt;
  
      &lt;!-- Hibernate / JPA --&gt;
      &lt;hibernate.version&gt;4.2.1.Final&lt;/hibernate.version&gt;
  
      &lt;!-- Logging --&gt;
      &lt;slf4j.version&gt;1.7.5&lt;/slf4j.version&gt;
  
      &lt;!-- Test --&gt;
      &lt;junit.version&gt;4.11&lt;/junit.version&gt;
  
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
    &lt;exclusions&gt;
        &lt;exclusion&gt;
          &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-jpa-2.0-api&lt;/artifactId&gt;
        &lt;/exclusion&gt;
      &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;!-- Spring MVC --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt; &lt;!-- Exclude Project-E from Project-B --&gt;
                  &lt;artifactId&gt;hibernate-jpa-2.0-api&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-websocket&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-messaging&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- Spring and Transactions --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
  
      &lt;/dependency&gt;
  
      &lt;!--Hibernate--&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;${hibernate.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;!--&amp;lt;!&amp;ndash; https://mvnrepository.com/artifact/org.hibernate/hibernate-tools &amp;ndash;&amp;gt;--&gt;
      &lt;!--&lt;dependency&gt;--&gt;
      &lt;!--&lt;groupId&gt;org.hibernate&lt;/groupId&gt;--&gt;
      &lt;!--&lt;artifactId&gt;hibernate-tools&lt;/artifactId&gt;--&gt;
      &lt;!--&lt;version&gt;4.0.0-CR1&lt;/version&gt;--&gt;
      &lt;!--&lt;/dependency&gt;--&gt;
  
  
  
      &lt;!--&amp;lt;!&amp;ndash; https://mvnrepository.com/artifact/javax.persistence/persistence-api &amp;ndash;&amp;gt;--&gt;
      &lt;!--&lt;dependency&gt;--&gt;
      &lt;!--&lt;groupId&gt;javax.persistence&lt;/groupId&gt;--&gt;
      &lt;!--&lt;artifactId&gt;persistence-api&lt;/artifactId&gt;--&gt;
      &lt;!--&lt;version&gt;RELEASE&lt;/version&gt;--&gt;
      &lt;!--&lt;/dependency&gt;--&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.1-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-jpa-2.1-api&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.Final&lt;/version&gt;
      &lt;/dependency&gt;
  
  
  
  
  
      &lt;!-- Other Web dependencies --&gt;
  
      &lt;!--&lt;dependency&gt;--&gt;
      &lt;!--&lt;groupId&gt;javax.servlet&lt;/groupId&gt;--&gt;
      &lt;!--&lt;artifactId&gt;servlet-api&lt;/artifactId&gt;--&gt;
      &lt;!--&lt;version&gt;2.5&lt;/version&gt;--&gt;
      &lt;!--&lt;scope&gt;provided&lt;/scope&gt;--&gt;
      &lt;!--&lt;/dependency&gt;--&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
          &lt;version&gt;3.0.20100224&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;jstl&lt;/artifactId&gt;
          &lt;version&gt;${jstl.version}&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet.jsp&lt;/groupId&gt;
          &lt;artifactId&gt;jsp-api&lt;/artifactId&gt;
          &lt;version&gt;${jsp.version}&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Websocket &amp; Tomcat --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
          &lt;artifactId&gt;tomcat-catalina&lt;/artifactId&gt;
          &lt;version&gt;${tomcat.version}&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
          &lt;artifactId&gt;tomcat-embed-websocket&lt;/artifactId&gt;
          &lt;version&gt;${tomcat.version}&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
  
  
      &lt;!-- Logging with SLF4J --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;version&gt;1.7.7&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
  
  
  
  
  
  
      &lt;!--&lt;dependency&gt;--&gt;
      &lt;!--&lt;groupId&gt;com.fasterxml.jackson.datatype&lt;/groupId&gt;--&gt;
      &lt;!--&lt;artifactId&gt;jackson-datatype-hibernate4&lt;/artifactId&gt;--&gt;
      &lt;!--&lt;version&gt;2.7&lt;/version&gt;--&gt;
      &lt;!--&lt;/dependency&gt;--&gt;
  
  
  
  
  
      &lt;!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
          &lt;version&gt;2.8.2&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;!-- JWT --&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.auth0&lt;/groupId&gt;
          &lt;artifactId&gt;java-jwt&lt;/artifactId&gt;
          &lt;version&gt;2.2.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Test Artifacts --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.11&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Exec cmd --&gt;
      &lt;!-- dependency&gt;
          &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
          &lt;artifactId&gt;commons-exec&lt;/artifactId&gt;
          &lt;version&gt;1.2&lt;/version&gt;
      &lt;/dependency --&gt;
  
      &lt;!-- Google GSON --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
          &lt;artifactId&gt;gson&lt;/artifactId&gt;
          &lt;version&gt;2.2.4&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- MySQL --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;version&gt;5.1.29&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
          &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
          &lt;version&gt;1.4&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.mail&lt;/groupId&gt;
          &lt;artifactId&gt;mail&lt;/artifactId&gt;
          &lt;version&gt;1.4&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Templating --&gt;
      &lt;!-- dependency&gt;
        &lt;groupId&gt;org.freemarker&lt;/groupId&gt;
        &lt;artifactId&gt;freemarker&lt;/artifactId&gt;
        &lt;version&gt;2.3.21&lt;/version&gt;
      &lt;/dependency --&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-remote-shell&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.BUILD-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
          &lt;version&gt;2.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
          &lt;version&gt;2.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-slf4j-impl&lt;/artifactId&gt;
          &lt;version&gt;2.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
          &lt;version&gt;1.7.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;jul-to-slf4j&lt;/artifactId&gt;
          &lt;version&gt;1.7.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-over-slf4j&lt;/artifactId&gt;
          &lt;version&gt;1.7.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.fusesource.mqtt-client&lt;/groupId&gt;
          &lt;artifactId&gt;mqtt-client&lt;/artifactId&gt;
          &lt;version&gt;1.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-batch&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.BUILD-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!--&lt;dependency&gt;--&gt;
      &lt;!--&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;--&gt;
      &lt;!--&lt;artifactId&gt;spring-boot-starter-batch&lt;/artifactId&gt;--&gt;
      &lt;!--&lt;version&gt;1.0.0.BUILD-SNAPSHOT&lt;/version&gt;--&gt;
      &lt;!--&lt;/dependency&gt;--&gt;
      &lt;!----&gt;
      &lt;!-- File upload (MultiPartResolver) --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
          &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
          &lt;version&gt;1.3.1&lt;/version&gt; &lt;!-- makesure correct version here --&gt;
      &lt;/dependency&gt;
  
      &lt;!-- SFTP Connection via JSch --&gt;
      &lt;!-- dependency&gt;
          &lt;groupId&gt;com.jcraft&lt;/groupId&gt;
          &lt;artifactId&gt;jsch&lt;/artifactId&gt;
          &lt;version&gt;0.1.51&lt;/version&gt;
      &lt;/dependency --&gt;
  
  
  
      &lt;!-- https://mvnrepository.com/artifact/com.opencsv/opencsv --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.opencsv&lt;/groupId&gt;
          &lt;artifactId&gt;opencsv&lt;/artifactId&gt;
          &lt;version&gt;3.3&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/org.apache.poi/poi --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
          &lt;artifactId&gt;poi&lt;/artifactId&gt;
          &lt;version&gt;3.14&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
          &lt;artifactId&gt;poi-ooxml&lt;/artifactId&gt;
          &lt;version&gt;3.14&lt;/version&gt;
      &lt;/dependency&gt;
  
  
  
      &lt;!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
          &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
          &lt;version&gt;3.4&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-beanutils&lt;/groupId&gt;
          &lt;artifactId&gt;commons-beanutils&lt;/artifactId&gt;
          &lt;version&gt;1.8.3&lt;/version&gt;
      &lt;/dependency&gt;
  
  
  
  
  
  &lt;/dependencies&gt;
  
  &lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;spring-snapshots&lt;/id&gt;
          &lt;name&gt;Spring Snapshots&lt;/name&gt;
          &lt;url&gt;http://repo.spring.io/snapshot&lt;/url&gt;
          &lt;snapshots&gt;
              &lt;enabled&gt;true&lt;/enabled&gt;
          &lt;/snapshots&gt;
      &lt;/repository&gt;
      &lt;repository&gt;
          &lt;id&gt;org.apache.tomcat&lt;/id&gt;
          &lt;name&gt;Repository hosting the jee6 artifacts&lt;/name&gt;
          &lt;url&gt;http://repo2.maven.org/maven2/org/apache/tomcat/&lt;/url&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>    package com.aratan.myapp.imports.convertor;
  
      import com.aratan.myapp.imports.constant.ImportType;
  
      import javax.persistence.AttributeConverter;
      import javax.persistence.Converter;
  
      /**
       * Created by ashishratan on 17/9/16.
       */
  
      @Converter(autoApply = true)
      public class ImportTypeConverter implements AttributeConverter&lt;ImportType, Integer&gt; {
          @Override
          public Integer convertToDatabaseColumn(ImportType x) {
              return x.getId();
          }
  
          @Override
          public ImportType convertToEntityAttribute(Integer y) {
              return ImportType.getById(y);
          }
      }
  
  
  
  
  
  
  
   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.aratan.myapp.dao.CustomerDao com.aratan.myapp.service.LoginServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerDaoImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getSessionFactory' defined in class path resource [com/aratan/myapp/config/HibernateConfig.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cfg.Configuration.addAttributeConverter(Ljava/lang/Class;)V
      ......
      .....
      at java.lang.Thread.run(Thread.java:745)
  Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.aratan.myapp.dao.CustomerDao com.aratan.myapp.service.LoginServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerDaoImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getSessionFactory' defined in class path resource [com/aratan/myapp/config/HibernateConfig.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cfg.Configuration.addAttributeConverter(Ljava/lang/Class;)V
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
      ... 58 more
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerDaoImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getSessionFactory' defined in class path resource [com/aratan/myapp/config/HibernateConfig.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cfg.Configuration.addAttributeConverter(Ljava/lang/Class;)V
      at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:308)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1127)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1051)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
      ... 60 more
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getSessionFactory' defined in class path resource [com/aratan/myapp/config/HibernateConfig.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cfg.Configuration.addAttributeConverter(Ljava/lang/Class;)V
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1127)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1051)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
      at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:457)
      at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:435)
      at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:559)
      at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:169)
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
      at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305)
      ... 71 more
  Caused by: java.lang.NoSuchMethodError: org.hibernate.cfg.Configuration.addAttributeConverter(Ljava/lang/Class;)V
      at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder$ConverterRegistrationDelegate.registerConverter(LocalSessionFactoryBuilder.java:389)
      at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.scanPackages(LocalSessionFactoryBuilder.java:311)
      at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:434)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1625)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562)
      ... 86 more
  </code></pre>
  
  <p>This is my Entity class that is using @Convert</p>
  
  <pre><code>import javax.persistence.*;
  
  @Entity
  @Table(name = "imports")
  public class Import {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
      @Column(insertable = false, updatable = false)
      private Long tenantId;
      @Column
  //    @Type(type = "com.aratan.myapp.imports.convertor.ImportType")
      @Convert(converter = ImportTypeConverter.class)
      private ImportType type;
  // all setter getter
  }
  </code></pre>
  
  <p>here is my Hibernate config class.</p>
  
  <pre><code>package com.aratan.myapp.config;
  
  import org.hibernate.SessionFactory;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.core.env.Environment;
  import org.springframework.jdbc.datasource.DriverManagerDataSource;
  import org.springframework.orm.hibernate4.HibernateTemplate;
  import org.springframework.orm.hibernate4.HibernateTransactionManager;
  import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
  import org.springframework.transaction.annotation.EnableTransactionManagement;
  
  import javax.sql.DataSource;
  import java.util.Properties;
  
  /**
   * Created by ashishratan on 12/8/16.
   */
  @Configuration
  @EnableTransactionManagement
  public class HibernateConfig {
  
  
  //    @Autowired
  //    private Environment env;
  
      //${jdbc.driverClassName}
      @Value("${jdbc.driverClassName}")
      private String driverClassName;
      @Value("${jdbc.url}")
      private String url;
      @Value("${jdbc.username}")
      private String username;
      @Value("${jdbc.password}")
      private String password;
  
      @Value("${hibernate.dialect}")
      private String hibernateDialect;
      @Value("${hibernate.show_sql}")
      private String hibernateShowSql;
      @Value("${hibernate.hbm2ddl.auto}")
      private String hibernateHbm2ddlAuto;
  
  
      @Bean()
      public DataSource getDataSource() {
          DriverManagerDataSource ds = new DriverManagerDataSource();
          ds.setDriverClassName(driverClassName);
          ds.setUrl(url);
          ds.setUsername(username);
          ds.setPassword(password);
          return ds;
      }
  
      @Bean
      public HibernateTransactionManager getTransactionManager(SessionFactory sessionFactory) {
          HibernateTransactionManager htm = new HibernateTransactionManager();
          htm.setSessionFactory(sessionFactory);
          return htm;
      }
  
  
      @Bean
      public HibernateTemplate getHibernateTemplate(SessionFactory sessionFactory) {
          return new HibernateTemplate(sessionFactory);
      }
  
      @Bean
      public LocalSessionFactoryBean getSessionFactory() {
          LocalSessionFactoryBean asfb = new LocalSessionFactoryBean();
          asfb.setDataSource(getDataSource());
          asfb.setHibernateProperties(getHibernateProperties());
          asfb.setPackagesToScan("com.aratan.myapp");
          return asfb;
      }
  
      @Bean
      public Properties getHibernateProperties() {
          Properties properties = new Properties();
          properties.put("hibernate.dialect", hibernateDialect);
          properties.put("hibernate.show_sql", hibernateShowSql);
          properties.put("hibernate.hbm2ddl.auto", hibernateHbm2ddlAuto);
  
          return properties;
      }
  
  }
  </code></pre>