sabbibJAVA
sabbibJAVA

Reputation: 1076

Spring's Class Cast exception error on spring

I am new to Java Spring Framework, and for some reason when I try to run this class I get a ClassCastException error. the three files of spring/main method, the secondary class and the Beans.xml screenshots are below. what am I doing wrong?

HelloSpring Class HelloWorld Class Beans.xml File Class Cast Exception error

Upvotes: 0

Views: 780

Answers (1)

Jens
Jens

Reputation: 69460

Your bean declaration in the xml is wrong. it must be:

<bean id="helloWorld" class="spring.test.HelloWorld"/>
                                              ^^^^^^ 

HelloSpring is your main class. HelloWorldis your bean class.

Upvotes: 1

Related Questions