{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/2633","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/2633/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/2633/comments","events_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/2633/events","html_url":"https://github.com/spring-projects/spring-boot/issues/2633","id":60633140,"number":2633,"title":"Caching auto-configuration","user":{"login":"snicoll","id":490484,"avatar_url":"https://avatars.githubusercontent.com/u/490484?v=3","gravatar_id":"","url":"https://api.github.com/users/snicoll","html_url":"https://github.com/snicoll","followers_url":"https://api.github.com/users/snicoll/followers","following_url":"https://api.github.com/users/snicoll/following{/other_user}","gists_url":"https://api.github.com/users/snicoll/gists{/gist_id}","starred_url":"https://api.github.com/users/snicoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snicoll/subscriptions","organizations_url":"https://api.github.com/users/snicoll/orgs","repos_url":"https://api.github.com/users/snicoll/repos","events_url":"https://api.github.com/users/snicoll/events{/privacy}","received_events_url":"https://api.github.com/users/snicoll/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spring-projects/spring-boot/labels/discussion","name":"discussion","color":"006b75"}],"state":"open","locked":false,"assignee":{"login":"snicoll","id":490484,"avatar_url":"https://avatars.githubusercontent.com/u/490484?v=3","gravatar_id":"","url":"https://api.github.com/users/snicoll","html_url":"https://github.com/snicoll","followers_url":"https://api.github.com/users/snicoll/followers","following_url":"https://api.github.com/users/snicoll/following{/other_user}","gists_url":"https://api.github.com/users/snicoll/gists{/gist_id}","starred_url":"https://api.github.com/users/snicoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snicoll/subscriptions","organizations_url":"https://api.github.com/users/snicoll/orgs","repos_url":"https://api.github.com/users/snicoll/repos","events_url":"https://api.github.com/users/snicoll/events{/privacy}","received_events_url":"https://api.github.com/users/snicoll/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/spring-projects/spring-boot/milestones/28","html_url":"https://github.com/spring-projects/spring-boot/milestones/1.3.0","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/milestones/28/labels","id":818466,"number":28,"title":"1.3.0","description":"","creator":{"login":"philwebb","id":519772,"avatar_url":"https://avatars.githubusercontent.com/u/519772?v=3","gravatar_id":"","url":"https://api.github.com/users/philwebb","html_url":"https://github.com/philwebb","followers_url":"https://api.github.com/users/philwebb/followers","following_url":"https://api.github.com/users/philwebb/following{/other_user}","gists_url":"https://api.github.com/users/philwebb/gists{/gist_id}","starred_url":"https://api.github.com/users/philwebb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philwebb/subscriptions","organizations_url":"https://api.github.com/users/philwebb/orgs","repos_url":"https://api.github.com/users/philwebb/repos","events_url":"https://api.github.com/users/philwebb/events{/privacy}","received_events_url":"https://api.github.com/users/philwebb/received_events","type":"User","site_admin":false},"open_issues":135,"closed_issues":13,"state":"open","created_at":"2014-10-08T15:00:46Z","updated_at":"2015-03-17T15:23:27Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2015-03-11T09:48:12Z","updated_at":"2015-03-17T15:25:27Z","closed_at":null,"body":"Given the revisited support as of Spring Framework 4.1, it would be nice to provide a better support for caching in Boot. There was already a failed attempt (#1553) and a recent PR for ehcache (#2602) brought the idea back to life.\r\n\r\nWe need this thing to be opt-in as the mere presence of a caching library in the classpath is no good reason to enable it. Fortunately (thanks @dsyer !) we can rely on the presence of `@EnableCaching` (more specifically a `CacheAspectSupport` bean). \r\n\r\nThese are the things we could auto-configure:\r\n\r\n* Redis\r\n* EhCache (via `ehcache.xml` on the classpath)  - #2602\r\n* JSR-107 (via the presence of a default JSR-107 provider)\r\n* \"Simple\" `ConcurrentHashMap` which would be the fallback if `@EnableCaching` is on and no caching library was found. It would be nice to draw the attention with a log of some form\r\n\r\nRoot namespace would be `spring.cache` with dedicated namespace for each solution (i.e. `spring.cache.ehcache`).\r\n\r\nWe could also go further and offer easy configuration of, for instance, `Guava` caches thought I doubt it will be handy via configuration properties (maybe yaml would offer a better experience?)\r\n\r\nOf course, all this should back-off if a `CacheManager` has been defined. `spring.cache.mode` is a key that defines the actual system to auto-configure when the user wants to be explicit with a deterministic order on our end (i.e. simple hash map < ehcache).\r\n"},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/comments/82411406","html_url":"https://github.com/spring-projects/spring-boot/issues/2633#issuecomment-82411406","issue_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/2633","id":82411406,"user":{"login":"snicoll","id":490484,"avatar_url":"https://avatars.githubusercontent.com/u/490484?v=3","gravatar_id":"","url":"https://api.github.com/users/snicoll","html_url":"https://github.com/snicoll","followers_url":"https://api.github.com/users/snicoll/followers","following_url":"https://api.github.com/users/snicoll/following{/other_user}","gists_url":"https://api.github.com/users/snicoll/gists{/gist_id}","starred_url":"https://api.github.com/users/snicoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snicoll/subscriptions","organizations_url":"https://api.github.com/users/snicoll/orgs","repos_url":"https://api.github.com/users/snicoll/repos","events_url":"https://api.github.com/users/snicoll/events{/privacy}","received_events_url":"https://api.github.com/users/snicoll/received_events","type":"User","site_admin":false},"created_at":"2015-03-17T15:25:27Z","updated_at":"2015-03-17T15:25:27Z","body":"Okay so I have started a branch that brings a basic support for caching auto-configuration. It supports redis, a generic `CacheManager` based on the presence of a `Cache` bean in the context and a simple concurrent map based implementation.\r\n\r\nWe have a PR pending for ehcache so we should integrate that here. Other options such as _jcache_ and _hazelcast_ comes to mind (we don't have any dependency to the latter right now). \r\n\r\nAdding `@EnableCaching` to the Spring Boot app should be enough. Of course, if the user defines a specific `CacheManager` the whole thing backs off. \r\n\r\nAny thought before we move forward?"}}