CGLIB is required to process @Configuration classes

Problem

Using Spring3 @Configuration to create an application configuration file like below :


import org.springframework.context.annotation.Configuration;

@Configuration
public class AppConfig {
	
	@Bean
   //...
	
}

However, when run it, it hits following error message :


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.mkyong.core.App.main(App.java:12)

Solution

To use @Configuration in Spring 3, you need to include the CGLIB library manually, just declares it in Maven pom.xml file.


	<dependency>
		<groupId>cglib</groupId>
		<artifactId>cglib</artifactId>
		<version>2.2.2</version>
	</dependency>

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
7 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
7 Comment authors
appeshAlex DonatoYuliaVishalPhilip Recent comment authors
newest oldest most voted
Vishal
Guest
Vishal

Thanks for this one. Saved a lot of time. I was just wondering if you can provide a link to documentation page around @Configuration as a reference.

Alex Donato
Guest
Alex Donato

You are the best ! Thanks you !!!!

appesh
Guest
appesh

Thank you

Yulia
Guest
Yulia

Thank you very much!!! It is really very important thing))))

Philip
Guest
Philip

Thanks for this! Saved me wasting lots of time as someone not very familiar with Spring OR Maven! Sometimes the short posts are the best :-)

Rich Cowin
Guest
Rich Cowin

Thanks. This saved me a bunch of time.

Burberry Outlet
Guest
Burberry Outlet

I follow threads and blogs.Love to post and comments.There are lot of stuff of me and hoping to receive as well from you.Thanks for sharing your article,it’s very nice,thanks.I hope can read more good articles.