I have a SpringBoot app that is on spring-boot 1.3.8. Which comes with Spring 4.2.8 by default.
SonarQube wants my rest api controller to use @GetMapping instead of @RequestMapping(method = RequestMethod.GET). This requires Spring 4.3.
So I tried to exclude spring-web and spring-webmvc 4.2.8 from spring-boot-starter-web and include spring-web and spring-webmvc 4.3.2.
As soon as I did that, my MockMvcBuilders.standaloneSetup(stateController).build() started to fail with this error
NoSuchMethodError org.springframework.aop.support.AopUtils.selectInvocableMethod
Has anyone run into this and how did you fix it?
Thanks!
Karl
@Before
public void setUp() {
try {
MockitoAnnotations.initMocks(this);
this.mockMvc = MockMvcBuilders.standaloneSetup(stateController).build();
} catch (Exception e) {
e.printStackTrace();
}
}
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>