You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class Person {
Integer id;
String name;
String firstname;
String lastname;
String addr;
}
public class PersonModel extends Model<Person, Integer> {
@Override
public GaarasonDataSource getGaarasonDataSource() {
GaarasonDataSource build = GaarasonDataSourceBuilder.build(new Sdata2Application().dataSource());
// 注释掉这行 就会报错
// new MysqlAutoconfiguration().init(build.getContainer());
return build;
}
public static void main(String[] args) {
var generalModel = new PersonModel();
var record = generalModel.newQuery()
.first();
System.out.println("record = " + record);
}
}
7 .预期效果
Exception in thread "main" gaarason.database.exception.ObjectNewInstanceException: Error instantiating object[interface gaarason.database.config.QueryBuilderConfig] with message : Error instantiating object[interface gaarason.database.config.QueryBuilderConfig]
at gaarason.database.provider.ContainerProvider.getBeansInside(ContainerProvider.java:144)
at gaarason.database.provider.ContainerProvider.getBeans(ContainerProvider.java:86)
at gaarason.database.connection.GaarasonDataSourceWrapper.getQueryBuilder(GaarasonDataSourceWrapper.java:329)
at gaarason.database.connection.GaarasonDataSourceWrapper.getQueryBuilder(GaarasonDataSourceWrapper.java:316)
at gaarason.database.eloquent.ModelOfQuery.theBuilder(ModelOfQuery.java:50)
at gaarason.database.eloquent.ModelOfQuery.newQuery(ModelOfQuery.java:55)
at com.example.sdata2.PersonModel.main(PersonModel.java:23)
Caused by: gaarason.database.exception.ObjectNewInstanceException: Error instantiating object[interface gaarason.database.config.QueryBuilderConfig]
at gaarason.database.util.ClassUtils.newInstance(ClassUtils.java:56)
at gaarason.database.provider.ContainerProvider.lambda$defaultNewInstance$1(ContainerProvider.java:160)
at gaarason.database.provider.ContainerProvider.getBeansInside(ContainerProvider.java:136)
... 6 more
Caused by: java.lang.NoSuchMethodException: gaarason.database.config.QueryBuilderConfig.<init>()
at java.base/java.lang.Class.getConstructor0(Class.java:3585)
at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2754)
at gaarason.database.util.ClassUtils.newInstance(ClassUtils.java:52)
... 8 more
Caused by: gaarason.database.exception.ObjectNewInstanceException: Error instantiating object[interface gaarason.database.config.QueryBuilderConfig]
Caused by: java.lang.NoSuchMethodException: gaarason.database.config.QueryBuilderConfig.<init>()
可以提供以下信息
bug类:
1 .使用的代码库的方式 ? (源码编译 / maven依赖 / 源码拷贝 ..)
2 .使用的代码库的方式版本 ? ( tag版本 / maven依赖版本 / commit hash ..)
3 .java版本
java 17
4 .框架以及版本 ( eg : spring boot 3.0.0 )
无框架
5 .数据库以及版本 ( eg : mysql 8.0.0 )
mysql8.0.27
6 .问题简述 ( 有必要的话, 可以贴下相关调用代码以及定义代码 )
以下是报错代码
7 .预期效果
建议类:
感觉像是直接实例化Model对象的时候, 没有把
MysqlQueryBuilderConfig
这个类给注册到container中.The text was updated successfully, but these errors were encountered: