Open hvne4j opened 3 weeks ago
函数签名传递的不对
请教一下,为什么我运行这个就会找不到方法呢?
public static void main(String[] args) throws Exception { DataSource ds = DataSourceUtil.build("com.zaxxer.hikari.HikariDataSource", "com.mysql.cj.jdbc.Driver", "xxx", "xxx", "xxx"); ExpressRunner runner = new ExpressRunner(); DefaultEnvironmentWorker.start(); IExpressContext<String,Object> expressContext = new DefaultContext<>(); DefaultService service = (DefaultService) ServiceProxy.temporary(ds); expressContext.put("service", service); DynamicParamsUtil.supportDynamicParams = true; Object r = runner.execute( "import org.anyline.service.init.DefaultService;\n" + "sorts = service.querys(\"sys_users\");\n" + "System.out.println(sorts);\n", expressContext, null,false, false); }
<dependency>
<groupId>org.anyline</groupId>
<artifactId>anyline-data-jdbc-mysql</artifactId>
<version>8.7.2-20240825</version>
</dependency>
构造函数用不定参数好像也不行
public DefaultConfigStore(String ... configs) { configs = BasicUtil.compress(configs); chain = new DefaultConfigChain(); for(String config:configs) { chain.addConfig(parseConfig(config)); } }
是不是因为没覆盖到 default里的方法 default DataSet querys(String dest, String... conditions) { return this.querys((String)dest, (Object)null, conditions); }
版本 3.3.3
除了不定参数,如果还有别的参数,就会报错
public void testMethodReplace() throws Exception { ExpressRunner runner = new ExpressRunner(); IExpressContext<String,Object> expressContext = new DefaultContext<String,Object>(); runner.addFunctionOfServiceMethod("getTemplate", this, "getTemplate", new Class[]{String[].class}, null);