Test configuration @SpringBootTest( webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:${server.port}/jwks.json", ... }, ... ) Application security configuration @EnableWebSecurity public class ApplicationWebSecurityConfiguration extends WebSecurityConfigurerAdapter { @Override public void configure(WebSecurity web) { web.ignoring() .antMatchers("/*.json"); } ... Maven dependency <dependency> <groupId>com.tymiq</groupId> <artifactId>spring-boot-jwt-test</artifactId> <version>0.1.2</version> <scope>test</scope> </dependency>