本文介绍了如何在Intellij IDEA运行之前启用Hibernate字节码检测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

在gradle中,您可以使用:

In gradle you can achieve it using:

apply plugin: 'enhance'
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.hibernate:hibernate-gradle-plugin:VERSION'
    }
}
dependencies {
    compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-[SPEC-VERSION]-api', version: '[IMPL-VERSION]'
    compile group: 'org.hibernate', name: 'hibernate-gradle-plugin', version: 'VERSION'
}

如果我不想通过Gradle运行项目,而是想直接通过Intellij(shift-F10)运行我的主类,该怎么办?是否有可能在应用程序运行之前也执行构建时字节码检测?我应该如何实现?

What if instead of running the project through Gradle, I want to run my main class directly through Intellij (shift-F10). Is it possible to also perform build-time bytecode instrumentation just before the application run? How should I achieve this?

推荐答案

Hibernate在运行时进行字节码检测",因此您不必为使其发生而做任何特殊的事情.

Hibernate does "bytecode instrumentation" at runtime, so you don't have to do anything special for it to happen.

实际上,这不是字节码检测,这意味着更改现有的类,而是代理,这意味着现有的类将由即时生成的类使用.

Actually it is not bytecode instrumentation, which means changing existing classes, but proxying, which means, the existing classes are used by classes that get generated on the fly.

这篇关于如何在Intellij IDEA运行之前启用Hibernate字节码检测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 22:22