{"action":"created","issue":{"url":"https://api.github.com/repos/micronaut-projects/micronaut-core/issues/1016","repository_url":"https://api.github.com/repos/micronaut-projects/micronaut-core","labels_url":"https://api.github.com/repos/micronaut-projects/micronaut-core/issues/1016/labels{/name}","comments_url":"https://api.github.com/repos/micronaut-projects/micronaut-core/issues/1016/comments","events_url":"https://api.github.com/repos/micronaut-projects/micronaut-core/issues/1016/events","html_url":"https://github.com/micronaut-projects/micronaut-core/issues/1016","id":389302976,"node_id":"MDU6SXNzdWUzODkzMDI5NzY=","number":1016,"title":"Cache name is translated from camel-case to dash-case ","user":{"login":"michalpetrov","id":1407127,"node_id":"MDQ6VXNlcjE0MDcxMjc=","avatar_url":"https://avatars3.githubusercontent.com/u/1407127?v=4","gravatar_id":"","url":"https://api.github.com/users/michalpetrov","html_url":"https://github.com/michalpetrov","followers_url":"https://api.github.com/users/michalpetrov/followers","following_url":"https://api.github.com/users/michalpetrov/following{/other_user}","gists_url":"https://api.github.com/users/michalpetrov/gists{/gist_id}","starred_url":"https://api.github.com/users/michalpetrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michalpetrov/subscriptions","organizations_url":"https://api.github.com/users/michalpetrov/orgs","repos_url":"https://api.github.com/users/michalpetrov/repos","events_url":"https://api.github.com/users/michalpetrov/events{/privacy}","received_events_url":"https://api.github.com/users/michalpetrov/received_events","type":"User","site_admin":false},"labels":[{"id":924953755,"node_id":"MDU6TGFiZWw5MjQ5NTM3NTU=","url":"https://api.github.com/repos/micronaut-projects/micronaut-core/labels/type:%20docs","name":"type: docs","color":"f9d577","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-10T13:32:35Z","updated_at":"2018-12-10T14:09:57Z","closed_at":null,"author_association":"NONE","body":"After naming a cache in application.yml in camel-case (e.g. \"myCache\"), you have to use a dash-case name in annotation (e.g. `@Cacheable(\"my-cache\")`). \r\n\r\n### Steps to Reproduce\r\n```java\r\npublic class Application {\r\n    public static void main(String[] args) {\r\n        ApplicationContext ctx = Micronaut.run(Application.class);\r\n        Cache cache = ctx.getBean(Cache.class);\r\n        System.out.println(cache.getData());\r\n    }\r\n}\r\n\r\n@Singleton\r\nclass Cache {\r\n    @Cacheable(\"myCache\")\r\n    String getData() {\r\n        return \"data\";\r\n    }\r\n}\r\n```\r\n\r\n```yml\r\n-- application.yml\r\nmicronaut:\r\n    application:\r\n        name: test-cache\r\n    caches:\r\n        myCache:\r\n            maximum-size: 10\r\n```\r\n\r\nThis throws exception `io.micronaut.context.exceptions.ConfigurationException: No cache configured for name: myCache`. After changing the annotation to `@Cacheable(\"my-cache\")` everytihng works as expected.\r\n\r\n### Expected Behaviour\r\nCache name should be the same in yml and annotation. Or at least (if this a limitation of Caffeine library) there should be a warning about the naming in the documentation (the documentation uses camel-case names too).\r\n\r\n### Actual Behaviour\r\nApplication throws exception because cache with provided name is not found.\r\n\r\n### Environment Information\r\n\r\n- **Operating System**: macOs Mojave 10.14\r\n- **Micronaut Version:** 1.0.1\r\n- **JDK Version:** OpenJDK Runtime Environment 18.9 (build 11.0.1+13)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/micronaut-projects/micronaut-core/issues/comments/445827833","html_url":"https://github.com/micronaut-projects/micronaut-core/issues/1016#issuecomment-445827833","issue_url":"https://api.github.com/repos/micronaut-projects/micronaut-core/issues/1016","id":445827833,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTgyNzgzMw==","user":{"login":"graemerocher","id":66626,"node_id":"MDQ6VXNlcjY2NjI2","avatar_url":"https://avatars2.githubusercontent.com/u/66626?v=4","gravatar_id":"","url":"https://api.github.com/users/graemerocher","html_url":"https://github.com/graemerocher","followers_url":"https://api.github.com/users/graemerocher/followers","following_url":"https://api.github.com/users/graemerocher/following{/other_user}","gists_url":"https://api.github.com/users/graemerocher/gists{/gist_id}","starred_url":"https://api.github.com/users/graemerocher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graemerocher/subscriptions","organizations_url":"https://api.github.com/users/graemerocher/orgs","repos_url":"https://api.github.com/users/graemerocher/repos","events_url":"https://api.github.com/users/graemerocher/events{/privacy}","received_events_url":"https://api.github.com/users/graemerocher/received_events","type":"User","site_admin":false},"created_at":"2018-12-10T14:09:57Z","updated_at":"2018-12-10T14:09:57Z","author_association":"MEMBER","body":"This is due to how configuration is normalised in Micronaut. This is a documentation issue and it should indeed be clarified in the documentation on how cache names are resolved. Thanks for the feedback "}}
{"actor":{"display_login":"graemerocher"}}