java - org.springframework.jdbc.support.KeyHolder cannot be resolved. It is indirectly referenced from required .class files -


i using hikari cp anf jdbc template insert incoming request parameters in controller database.

so following:

@restcontroller public class homecontroller  {  @autowired     private jdbctemplate jtm;   @requestmapping(value="/insert/data",produces={mediatype.application_json_value},method=requestmethod.get)     public responseentity<?> insertdata(@requestparam("id")int id ,@requestparam("name")string name) throws ioexception, classnotfoundexception, sqlexception{              string sql = "insert public.users(id, name) values (?, ?, ?);";               jtm.update(sql,id,name);   } } 

but throws following error:

the type org.springframework.jdbc.support.keyholder cannot resolved. indirectly referenced required .class files 

i have hikari.properties in /src/main/resources

driverclassname=org.postgresql.driver jdbcurl=jdbc:postgresql://10.1.9.72:5432/data_base maximumpoolsize=20 username=user password=password datasource.cacheprepstmts=true datasource.prepstmtcachesize=250 datasource.prepstmtcachesqllimit=2048 

my configuration java class hikaricp

appconfig.java

import com.zaxxer.hikari.hikariconfig; import com.zaxxer.hikari.hikaridatasource; import java.sql.sqlexception; import javax.sql.datasource; import org.springframework.context.annotation.bean; import org.springframework.context.annotation.configuration;  @configuration public class appconfig {      @bean(destroymethod = "close")     public datasource datasource() throws sqlexception {         hikariconfig config = new hikariconfig("/hikari.properties");         hikaridatasource datasource = new hikaridatasource(config);          return datasource;     } } 

i added following dependencies (hikari cp ,spring jbdc ,spring-tx) in pom.xml

 <dependency>         <groupid>org.springframework.boot</groupid>             <artifactid>spring-boot-starter-jdbc</artifactid>     </dependency>       <dependency>         <groupid>com.zaxxer</groupid>         <artifactid>hikaricp-java7</artifactid>         <version>2.4.12</version>     </dependency> <dependency>     <groupid>org.springframework</groupid>     <artifactid>spring-tx</artifactid>     <version>3.0.0.release</version> </dependency> <dependency>     <groupid>org.springframework</groupid>     <artifactid>spring-jdbc</artifactid>     <version>3.2.1.release</version> </dependency> 

any appreciated


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -