How to unit test a secured controller which uses thymeleaf (without getting TemplateProcessingException)?

前端 未结 2 1609
故里飘歌
故里飘歌 2021-01-05 16:46

I am trying to run a unit test in spring-boot using spring security and a simple home (root) controller which uses thymeleaf for the template processing. I am trying to writ

2条回答
  •  别那么骄傲
    2021-01-05 17:30

    If you don't care about testing returned view and would like to only test the controller, simply disable Thymeleaf is Spring boot 2+ in your test application properties file

    spring.thymeleaf.enabled=false
    

提交回复
热议问题