Testing with Spring and Maven: applicationContext

前端 未结 9 1572
-上瘾入骨i
-上瘾入骨i 2020-12-13 04:04

Seems that question old as world, but I still can\'t find out the solution..

I\'m trying to run simple test:

@RunWith(SpringJUnit4ClassRunner.class)
         


        
9条回答
  •  旧时难觅i
    2020-12-13 04:57

    I think Maven simply didn't include the XML file from main/resources.

    You could try to specify explicitly what to include in the pom.xml.

    Let me know if the following configuration has worked:

        
        
            
                true
                src/test/resources
                
                    **/*.properties
                
                
                    **/*local.properties
                
            
            
                src/main/resources
                
                    **/*.properties
                    **/*.xml
                
            
        
    

    This is something I use in your case. You can edit this if you don't have properties files to be included.

提交回复
热议问题