Spring Security dependency check for SpringSecurityDialect seems to be lost when restoring support for Thymeleaf, see 12cd97a. So I restored it and added some unit tests.

Related: #28967

Comment From: wilkinsona

Thanks very much, @terminux. I pulled the test side of this out into a separate issue so it could be tackled in our maintenance branches too.