Closed
Description
Describe the bug
After a recent update of Spring Boot extension for VSCode, it starts to suggest removing @Autowired
annotation from JUnit tests
However, after the annotation is removed, test is unable to get launched:
org.junit.jupiter.api.extension.ParameterResolutionException: No ParameterResolver registered for parameter [org.springframework.test.web.servlet.MockMvc mvc] in constructor [public com.newpathfly.flightsupplier.via.service.SearchServiceIT(org.springframework.test.web.servlet.MockMvc,java.lang.String)].
at java.util.Optional.orElseGet([Optional.java:267](vscode-file://vscode-app/c:/Users/xiaoh/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html))
at java.util.ArrayList.forEach([ArrayList.java:1259](vscode-file://vscode-app/c:/Users/xiaoh/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html))
at java.util.ArrayList.forEach([ArrayList.java:1259](vscode-file://vscode-app/c:/Users/xiaoh/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html))
To Reproduce
Build a simple Spring Boot test in an existing Spring Boot project:
@SpringBootTest
@AutoConfigureMockMvc
class WhateverIT {
private final MockMvc _mvc;
public WhateverIT (MockMvc mvc) {
_mvc = mvc;
}
@Test
void dummyTest() {
}
Note that
@Autowired
does not exist.
Then try to launch the test from VSCode