Error occurs because MAPPER cannot be found while MYBATIS and HIKARICP are being linked.
The MYBATIS-HIKARICP was set up in Java code. Perform normal operation except for HIKARICP.
Configuration configuration = new Configuration();
configuration.setDefaultStatementTimeout(30);
configuration.setCacheEnabled(true);
configuration.addMappers("C:\ORACLE_MAAPER");
HikariConfig config = new HikariConfig();
config.setMinimumIdle(dataBaseMap.get(pd.getKEY()));
config.setMaximumPoolSize(dataBaseMap.get(pd.getKEY()) * 2);
config.setConnectionTestQuery("SELECT 1 FROM DUAL");
config.setConnectionTimeout(300000);
config.setDriverClassName(setDriverName(pd.getDBMS()));
config.addDataSourceProperty("user", pd.getID());
config.addDataSourceProperty("password", pd.getPWD());
config.setJdbcUrl(setConnUrl(pd.getDBMS(), pd.getIP(), pd.getPORT(), pd.getNAME()));
configuration.setEnvironment(new Environment(pd.getKEY(), new JdbcTransactionFactory(), new HikariDataSource(config)));
It should operate normally and execute QUERY, but an error will occur. I also tried "file:///C:\\MAPPER.xml".
org.apache.ibatis.session.Configuration.addMappers(String)
takes a package name as a parameter.
So instead of C:\\ORACLE_MAAPER
(BTW with typo apparently) you should specify the package where the mappers are located.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.