问答详情
源自:6-1 SpringBoot 整合freemarker

freemarker 模板报错

@Controller

@RequestMapping("ftl")

public class IndexController {

    @Autowired    

    private Resource resource;

    @RequestMapping("/index")

    public String index(ModelMap map) {

        map.addAttribute("resource", resource);

            return "index";

        }

}


freemarker 模板报错 

Description: Field resource in com.hibo.controller.IndexController required a bean of type 'org.springframework.core.io.Resource' that could not be found.

Action: Consider defining a bean of type 'org.springframework.core.io.Resource' in your configuration.



提问者:yahibo 2018-06-25 17:23

个回答

  • 虹晔
    2019-03-23 18:19:13

    我也是这个错误,这个你怎么解决的

  • yahibo
    2018-06-25 18:06:19

    问题解决