Monday, 15 July 2013

spring - Using ClassPathXmlApplicationContext to load beans -



spring - Using ClassPathXmlApplicationContext to load beans -

this interface

public interface personneservice { public void add(personne personne); public void delete (int personneid); public personne getpersonne(int personneid); public list getallpersonne(); }

this class main

import static org.junit.assert.*; import java.util.list; import org.junit.afterclass; import org.junit.beforeclass; import org.junit.test; import org.springframework.context.support.classpathxmlapplicationcontext; import com.test.model.personne; public class personneservicetest { private static classpathxmlapplicationcontext context; private static personneservice personneservice; @beforeclass public static void setupbeforeclass() throws exception { context= new classpathxmlapplicationcontext("applicationcontext.xml"); personneservice=(personneservice) context.getbean("personneservice"); } @afterclass public static void teardownafterclass() throws exception { context.close(); }

this error

org.springframework.context.support.abstractapplicationcontext preparerefresh infos: refreshing org.springframework.context.support.classpathxmlapplicationcontext@1b10f9a: display name [org.springframework.context.support.classpathxmlapplicationcontext@1b10f9a]; startup date [mon jun 23 11:03:13 west 2014]; root of context hierarchy juin 23, 2014 11:03:13 org.springframework.beans.factory.xml.xmlbeandefinitionreader loadbeandefinitions infos: loading xml bean definitions class path resource [applicationcontext.xml] juin 23, 2014 11:03:14 org.springframework.context.support.abstractapplicationcontext obtainfreshbeanfactory infos: bean mill application context [org.springframework.context.support.classpathxmlapplicationcontext@1b10f9a]: org.springframework.beans.factory.support.defaultlistablebeanfactory@648a34

here error while doing sample project in spring. application-context.xml in src doesn't work:

java.lang.noclassdeffounderror: org/antlr/runtime/recognitionexception

spring

No comments:

Post a Comment