Spring JUnit Test Error

后端 未结 6 1100
無奈伤痛
無奈伤痛 2020-12-16 09:17

I am receiving the following error when I attempt to run my Spring JUnit test. I am just trying to get familiar with creating JUnits using the Spring Framework.

JUni

6条回答
  •  星月不相逢
    2020-12-16 10:05

    It complains about java.lang.NoSuchMethodError and I think this has to do with your spring dependencies. Try changing your spring dependencies like this:

        
            org.springframework
            spring-beans
            3.1.0.RC1
        
        
            org.springframework
            spring-aspects
            3.1.0.RC1
        
        
            org.springframework
            spring-context
            3.1.0.RC1
            compile
            
                
                    commons-logging
                    commons-logging
                
            
        
        
            org.springframework
            spring-core
            3.1.0.RC1
        
        
            org.springframework
            spring-asm
            3.1.0.RC1
        
        
            org.springframework
            spring-aop
            3.1.0.RC1
        
        
            org.springframework
            spring-expression
            3.1.0.RC1
        
        
            org.springframework
            spring-orm
            3.1.0.RC1
        
        
            org.springframework
            spring-test
            3.1.0.RC1
        
    

    And I don't know where following dependencies come from, but I think they might need correction with their artifactId as well:

        
            org.springframework
            org.springframework.transaction
            3.1.0.RC1
        
    
        
            org.springframework.data
            spring-data-commons-core
            1.2.0.BUILD-SNAPSHOT
        
        
            org.springframework.data
            spring-data-mongodb
            1.0.0.M5
        
        
            org.springframework.data
            spring-data-mongodb-cross-store
            1.0.0.M5
        
        
            org.springframework.data
            spring-data-mongodb-log4j
            1.0.0.M5
        
        
            org.mongodb
            mongodb-java-driver
            2.7.2
        
    

    And one final thing that I want you to consider, do you really, really need ALL of those dependencies?

提交回复
热议问题