私はSpringベースのコンフィグレーションでSpring 3.2を使用しており、ユニットテスト(JUnit 4.8.1)にいくつか問題があります。なぜ私はこのエラーを受け取りますSpring blog状態としてJavaベースのコンフィグレーションでのSpring 3.2ユニットテスト
Caused by: java.lang.IllegalStateException: CGLIB is required to process @Configuration classes. Either add CGLIB to the classpath or remove the following @Configuration bean definitions: [testConfig]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:327)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:222)
、春3.2はCGLIB 3をインライン化されています
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes={TestConfig.class})
public class ManualTest
{
@Autowired
...
Howeever、私はこのエラーが発生します:これはテストランナーのですか?
ビルド管理ツールとしてGradle 1.3を、IDEとしてSTSを使用しています。 gradle eclipse
のGradleを呼び出す場合は、二度の依存関係を引き込む:平野jarファイルとライブラリと1時間と1時間:
やライブラリとしてより:
プレーン瓶など
ファーストをプレーンジャーのセクションでは、私はまだSpring 3.1を構成していましたが、ライブラリのセクションではSpring 3.2でした。だから私は普通の瓶を取り除き、すべてが機能していた。
これは私がすべてのEclipseプロジェクトと設定し、すべてのGradleの一時ファイルを削除
configurations
{
driver
}
dependencies
{
driver 'com.oracle:ojdbc6:11.2.0'
compile "org.springframework:spring-jdbc:$springVersion"
testCompile 'com.oracle:ojdbc6:11.2.0'
testCompile "org.springframework:spring-test:$springVersion"
testCompile "commons-dbcp:commons-dbcp:$dbcpVersion"
testCompile "junit:junit:$junitVersion"
testCompile "org.slf4j:slf4j-log4j12:$slf4jVersion"
}
sourceSets
{
main
{
java
{
srcDirs 'src/main/java', "$buildDir/generated-sources/"
}
}
}
そして、マスタープロジェクト
configure(allprojects)
{
ext.dbcpVersion = '1.4'
ext.springVersion = '3.2.0.RELEASE'
ext.junitVersion = '4.8.1'
ext.slf4jVersion = '1.7.2'
}
subprojects
{
// Artifact settings
group = 'xxx'
version = '1.0-SNAPSHOT'
// Standard plugins
apply plugin: 'java'
apply plugin: 'eclipse'
// Repositories
repositories
{
mavenLocal()
maven
{
url "http://repo.springsource.org/release"
}
mavenCentral()
}
// Standard dependencies
dependencies
{
}
}
あなたのクラスパスコンテンツを投稿できますか?またはmavenを使用している場合はpom.xml? – ElderMael
Eclipseとgradleコマンドラインの両方で失敗しますか? – artbristol
Eclipse(STS)のみ。 – ChrLipp