Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Spring Spring3 Spring cglib2

Related Tutorials


 
 

Share on Google+Share on Google+

Spring cglib2

Advertisement
The cglib2 framework is used by Spring to manipulate Java classes in run time.

Spring cglib

     

In this section we will learn about Spring cglib library and understand the importance of it. You will also find the url to download cglib library

What is cglib?

The cglib is high performance library in Java. It is used to extend Java classes and implement interfaces in runtime. It is one the best quality code generation library available in Java. The latest version of cglib library can be downloaded from http://cglib.sourceforge.net/.

The cglib library is free software and can be used for personal and commercial purposes.

Spring 3 framework uses cglib2 for manipulating the Java classes in runtime. The cglib library is not included in Spring 3.0 distribution. So, you have to manually download and include in your project.

On the cglib home page you will find the link to download.

If you don't include the cglib dependency in your Spring 3 project you might get the following error:

Jan 2, 2010 3:22:07 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh

INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@15eb0a9:
startup date [Sat Jan 02 15:22:07 IST 2010]; root of context hierarchy

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: [spring3HelloWorldConfig]

at org.springframework.context.annotation.ConfigurationClassPost
Processor.enhanceConfigurationClasses(
ConfigurationClassPostProcessor.java:257)

at org.springframework.context.annotation.ConfigurationClass
PostProcessor.postProcessBeanFactory(
ConfigurationClassPostProcessor.java:147)

at org.springframework.context.support.AbstractApplicationContext.invokeBean
FactoryPostProcessors(
AbstractApplicationContext.java:624)

at org.springframework.context.support.AbstractApplicationContext.invoke
BeanFactoryPostProcessors(
AbstractApplicationContext.java:614)

at org.springframework.context.support.AbstractApplication
Context.refresh(
AbstractApplicationContext.java:398)

at org.springframework.context.annotation.Annotation
ConfigApplicationContext.<init>(
AnnotationConfigApplicationContext.java:65)

at net.roseindia.Spring3HelloWorldConfigTest.main(Spring3HelloWorldConfigTest.java:9)

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 2, 2010

Related Tutorials

Discuss: Spring cglib2  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
Hallah Amine
January 5, 2013
learning spring

No thing
DMCA.com