错误描述:

 

无法接受前端发送的json字符串,后端无法打印信息。

错误代码:

@Configuration
@ComponentScan("com.woniu.controller")

public class SpringMvcConfig {



}

错误原因:

配置类中没有写@EnableWebMvc注解,springmvc无法进行类型转化。

修改后的代码:

@Configuration
@ComponentScan("com.woniu.controller")
@EnableWebMvc
public class SpringMvcConfig {



}

可以正常运行:

更多推荐

org.springframework.web.HttpMediaTypeNotSupportedException Content type ‘ap