importorg.junit.jupiter.api.Test;importorg.springframework.context.ApplicationContext;importorg.springframework.context.support.ClassPathXmlApplicationContext;publicclassTestUser{@TestpublicvoidtestUserObject(){//加載spring配置文件,對象創建ApplicationContext context =newClassPathXmlApplicationContext("bean.xml");//獲取創建的對象User user =(User)context.getBean("user");System.out.println("1:"+user);//使用對象調用方法進行測試System.out.print("2:");user.add();}}
問題:
maven install報錯:The packaging for this project did not assign a file to the build artifact 解決方案:
方案1:
使用mvn clean install 就可以解決問題,
方案2:
找到lifecycle點clean再點…