You and I must have been banging our heads against the same thing at the same time it seems.
I was able to make @AutoConfigureMockMvc(secure=false)
do exactly what I wanted--disable all security for my unit tests. However, it was immediately marked deprecated in my IDE because I was using Spring Boot 2.1.6. I don't like using deprecated things so I tried and tried to get the exclude
attribute to work, but it never did.
I was about to give up on it and suffer with the deprecation warning because at least my unit tests worked with it.
On a whim, I tried upgrading Spring Boot in my project from 2.1.6 to 2.2.2. To my horror, the secure
attribute was no longer deprecated--it was removed altogether! I gave the unit test a spin with the attribute gone, but with the exclude
attribute populated exactly as you show in your question and it worked!
TL;DR? Upgrade to Spring Boot 2.2.2