支持Graalvm的ORM框架-Gaarason

https://github.com/gaarason/database-all  

注意事项

  • 声明 model 是使用 @Component 而非 @Repository
  • 依赖注入是使用 @Autowired 而非 @Resource
  • 所有自定的 Autoconfiguration 需要手动执行init()
  • 所有 model 和 entity 需要反射, 即通过 @TypeHint 声明
  • @Column 中有使用到的 自定义class, 都需要反射, 即通过 @TypeHint 声明
  • 所有 model 不能实现其他的自定义接口
  • lambda风格字段不可使用
  • 所有 model 需要 container.getBean(ModelShadowProvider.class).loadModels() , 目前做了动态加载, 建议model定义为entity的内部类

应该还有其他的不兼容的地方, 以后补充

@NativeHint(
    types = @TypeHint(types = {
        // entity
        // ...

        GeneralModel.class,
        GeneralModel.Table.class
    }),
    jdkProxies = @JdkProxyHint(types = {
        // interface
        // ...

        Model.class,
        SoftDelete.class,
        Query.class,
        SpringProxy.class,
        Advised.class,
        DecoratingProxy.class
    }),
    aotProxies = {
        // model
        // ...
        
        @AotProxyHint(targetClass = GeneralModel.class)
    }
)
@SpringBootApplication(proxyBeanMethods = false)
public class GraalVmCompatibilityApplication {
    public static void main(String[] args) throws InterruptedException {
        try {
            SpringApplication.run(GraalVmCompatibilityApplication.class, args);
        } catch (Throwable throwable) {
            System.out.println("something is error.");
            System.out.println(throwable.getMessage());
            System.out.println(Arrays.toString(throwable.getStackTrace()));
        }
        new CountDownLatch(1).await();
    }
}

 

posted @ 2022-09-26 10:42  xutengx  阅读(108)  评论(0)    收藏  举报