Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Spring
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Liutauras Vilda
Paul Clapham
Sheriffs:
paul wheaton
Tim Cooke
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Piet Souris
Bartenders:
Mike London
Forum:
Spring
error in Spring framework
ashok movva
Greenhorn
Posts: 19
posted 5 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I got an error while doing basic spring application program...
This is SpringConfig.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns:="http://www.springframework.org/schema/beans" xlmns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <beans> <bean id="Restaruant" class="com.spring.Restaurant"> <property name = "message" value = "Hello World!"/> </bean> </bean> </beans>
Restaurant Bean class....
public class Restaurant { String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
Class to
Test
the above Code...
import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class TestSpring { ApplicationContext context=new ClassPathXmlApplicationContext("SpringConfig.xml"); Restaurant obj=(Restaurant) context.getBean("restaruant"); obj.getMessage();}
Error in the last line i.e at obj.getMessage();
Error message is: identifier expected at the end.
H Paul
Ranch Hand
Posts: 491
5
posted 5 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Check the variable name / bean id in the xml configure line 8 vs the one used in code line 6.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Different instance variable and local variable names in Entity class
New to Spring
problem in Spring first program
I want to study Spring,but i need Help
Illegal argument exception
More...