我想从jar文件(common-1.0.jar)加载applicationContext。我在独立应用程序中使用了这些步骤,
pom文件中的:
<dependency>
<groupId>com.cityid</groupId>
<artifactId>common</artifactId>
<version>1.0</version>
</dependency>
之后我使用:
private static BeanFactory factory = null;
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(
new String[] {"spring/mainContext.xml"});
factory = (BeanFactory) appContext;
PartyFacade partyFacade = (PartyFacade) factory.getBean("partyFacade");
//Party party = new PartyFacade(); //Entity
partyFacade.fillParty();
我可以加载PartyFacadeBean但是我无法加载新的实体,例如Party它会抛出nullpoint异常!这种方法适用于Beans,它对DAO或Entity不起作用。如何使用新实体并将它们单独填写?