xml - Warning in first Spring project -
i`m beginner in spring. easy example "hello world", have warning.
my pom.xml:
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.pavlo.firstspring</groupid> <artifactid>mavenspringdevcolibrifirst</artifactid> <version>1.0-snapshot</version> <dependencies> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context-support</artifactid> <version>4.3.3.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>4.3.3.release</version> </dependency> </dependencies> </project>
my helloworld.java
package com.pavlo.firstspring; public class helloworld { private string message; public void setmessage(string message){ this.message = message; } public void getmessage(){ system.out.println("your message : " + message); } }
my beans.xml:
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd"> <bean id="helloworld" class="com.pavlo.firstspring.helloworld"> <property name="message" value="hello world!"/> </bean> </beans>
my mainapp.java:
package com.pavlo.firstspring; import org.springframework.context.applicationcontext; import org.springframework.context.support.filesystemxmlapplicationcontext; public class mainapp { public static void main(string[] args) { applicationcontext context = new filesystemxmlapplicationcontext("d:/mavenspringdevcolibrifirst/src/main/resources/beans.xml"); helloworld obj = (helloworld) context.getbean("helloworld"); obj.getmessage(); } }
in console :
sep 22, 2016 4:38:11 pm org.springframework.context.support.filesystemxmlapplicationcontext preparerefresh info: refreshing org.springframework.context.support.filesystemxmlapplicationcontext@238e0d81: startup date [thu sep 22 16:38:11 eest 2016]; root of context hierarchy sep 22, 2016 4:38:12 pm org.springframework.beans.factory.xml.xmlbeandefinitionreader loadbeandefinitions info: loading xml bean definitions file [d:\mavenspringdevcolibrifirst\src\main\resources\beans.xml]
your message : hello world!
where mistake?
Comments
Post a Comment