When I try to upgradeĀ mongo-java-driver from 3.11.X to 3.12.X. The following code breaks.
@RunWith(SpringJUnit4ClassRunner.class)
|
@ContextConfiguration("classpath:spring-mvc-servlet.xml")
|
public class DatabaseTest {
|
|
@Autowired
|
private IPersonService personService;
|
|
@Test
|
public void testConnection() {
|
try {
|
personService.findById("1");
|
} catch (Exception e) {
|
System.out.println("!!!!!!!!");
|
fail("Database connection failed!");
|
}
|
}
|
}
|
public interface IPersonService {
|
|
Person findById(String id);
|
}
|
public class Person {
|
private String id;
|
}
|
The test should pass, but it failed with the error "Database connection failed!"
The related configuration files are in the attachment.