java spring spring-boot spring-cache spring-el

Spring Boot – How to disable @Cacheable during development?

I’m looking for 2 things:

  1. How to disable all caching during development with Spring boot “dev” profile. There doesn’t seam to be a general setting to turn it all off in What’s the easiest way?

  2. How to disable caching for a specific method? I tried to use SpEl like this:

    @Cacheable(value = "complex-calc", condition="#${} != 'dev'}")
    public String someBigCalculation(String input){

But I can get it to work. There are a couple of questions on SO related to this, but they refer to XML config or other things, but I’m using Spring Boot 1.3.3 and this uses auto-configuration.

I don’t want to over-complicate things.