でその機能を果たしていないドメインオブジェクトは、次のように設定され:ロンボクの使用は、 - それは、ユニットテスト
@Data
@NoArgsConstructor
@Entity
public class Foo {
...
public Foo(...){
...
}
...
}
私は一連のテストでビルドを実行したときにそれは結構です。私は唯一のテストクラスを実行すると、しかし、私は次のエラーを取得する:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: No default constructor for entity: : com.abc.myapp.Foo; nested exception is org.hibernate.InstantiationException: No default constructor for entity: : com.abc.myapp.Foo
プロジェクトのセットアップがspring.ioのプロジェクトジェネレータによって生成された春ブーツです。
buildscript {
ext {
springBootVersion = '1.5.0.RC1'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle- plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
jar {
baseName = 'spring-data-samples'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-actuator-docs')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-data-rest')
runtime('org.springframework.boot:spring-boot-devtools')
runtime('com.h2database:h2')
compileOnly('org.projectlombok:lombok')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.restdocs:spring-restdocs-mockmvc')
}
とIDEがのIntelliJアイデアです:そして、次はGradleのファイルをビルドしています。
何が欠けていますか?
明らかに、セットアップの中でlombokを起動した部分がテスト設定で破損しています。私たちはあなたの設定について絶対に何も知らないので、私たちは手伝ってはいけません。しかし、プラグインの関連する設定を含め、アプリケーションをビルドするにはどうすればよいですか(ビルドツール、IDEなど)、関連する情報を提供したい場合があります。アプリケーションをどのように実行し、どのようにテストを実行しますか?もう一度関連するプラグインと設定を含めてください。 –
こんにちはジェンス、ありがとう。私は私の質問にプロジェクトビルド/構成情報を追加します。私はプロジェクトのためのプラグインを持っていません。 – vic