@Configurationクラスを処理するにはCGLIBが必要です
問題
Spring3@Configuration
を使用して、以下のようなアプリケーション構成ファイルを作成します。
import org.springframework.context.annotation.Configuration; @Configuration public class AppConfig { @Bean //... }
ただし、実行すると、次のエラーメッセージが表示されます。
org.springframework.context.support.AbstractApplicationContext prepareRefresh //... Exception in thread "main" java.lang.IllegalStateException: CGLIB is required to process @Configuration classes. Either add CGLIB to the classpath or remove the following @Configuration bean definitions: [appConfig] //... at com.example.core.App.main(App.java:12)
溶液
Spring 3で@Configuration
を使用するには、CGLIBライブラリを手動でインクルードする必要があります。Mavenpom.xml
ファイルで宣言するだけです。
cglib cglib 2.2.2