CGLIB ist erforderlich, um @Configuration-Klassen zu verarbeiten
Problem
Verwenden von Spring3@Configuration
zum Erstellen einer Anwendungskonfigurationsdatei wie folgt:
import org.springframework.context.annotation.Configuration; @Configuration public class AppConfig { @Bean //... }
Beim Ausführen wird jedoch die folgende Fehlermeldung angezeigt:
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)
Lösung
Um@Configuration
in Spring 3 zu verwenden, müssen Sie dieCGLIB-Bibliothek manuell einbinden und nur in der Mavenpom.xml
-Datei deklarieren.
cglib cglib 2.2.2