# AtlassianHostRestClients auto caching oauth-2-clients

**URL:** <https://community.developer.atlassian.com/t/atlassianhostrestclients-auto-caching-oauth-2-clients/72763>\
**Category:** Atlassian Developer Tools\
**Tags:** cache, oauth2, ac-spring-boot, atlassian-connect\
**Created:** [September 11, 2023, 9:37am UTC](https://community.developer.atlassian.com/t/atlassianhostrestclients-auto-caching-oauth-2-clients/72763 "2023-09-11T09:37:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AdriianSemotiuk](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@AdriianSemotiuk](https://community.developer.atlassian.com/u/AdriianSemotiuk)\
**Post date:** [September 11, 2023, 9:37am UTC](https://community.developer.atlassian.com/t/atlassianhostrestclients-auto-caching-oauth-2-clients/72763/1 "2023-09-11T09:37:29Z")

</div>

I am new to caching, and i have a Spring Boot application via atlassian connect, and i`ve noticed that every time that i make some calls to atlassian , i have this cache in my application

```auto
 "caches": {
        "oauth-2-clients": {
          "target": "org.springframework.cache.support.NoOpCache"
        }
      }

```

and i know that this comes from AtlassianHostRestClients.authenticatedAsHostActor()  
cause i found that this method will automatically store user info i cache  
`https://www.javadoc.io/doc/com.atlassian.connect/atlassian-connect-spring-boot-api/latest/com/atlassian/connect/spring/AtlassianHostRestClients.html`  
But this is causing errors in my application  
My question is how i can disable this caching or delete it  
I`ve tried to use **@CacheEvict(value=“oauth-2-clients”, allEntries=true)** and **spring.cache.type=NONE** , but none of this worked

---

<div class="post-metadata">

**Author:** ![markrekveld](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/markrekveld/32/36150_2.png) [@markrekveld](https://community.developer.atlassian.com/u/markrekveld)\
**Post date:** [September 11, 2023, 11:14am UTC](https://community.developer.atlassian.com/t/atlassianhostrestclients-auto-caching-oauth-2-clients/72763/2 "2023-09-11T11:14:54Z")

</div>

Hi @AdriianSemotiuk

Welcome to the community.

You should be able to disable Spring caching by setting the `spring.cache.type=NONE` in your `application.properties` file, or

```auto
spring:
  cache:
    type: NONE

```

In your `application.yml` file.  
If this is not working then it could be that the configuration is not loading the setting, try running Spring boot in debug mode so that it will log where it is loading properties from.

Otherwise you can also opt to add a `NoOpCacheManager` bean to your Spring bean configuration.  
This can be as simple as

```auto
import org.springframework.cache.support.NoOpCacheManager; 

@Configuration
public class CacheManagerConfiguration {
    @Bean
    public CacheManager getNoOpCacheManager() {
        return new NoOpCacheManager();
    }
}

```

Cheers,  
Mark

---

<div class="post-metadata">

**Author:** ![AdriianSemotiuk](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@AdriianSemotiuk](https://community.developer.atlassian.com/u/AdriianSemotiuk)\
**Post date:** [September 11, 2023, 11:24am UTC](https://community.developer.atlassian.com/t/atlassianhostrestclients-auto-caching-oauth-2-clients/72763/3 "2023-09-11T11:24:01Z")

</div>

Unfortunately , after adding NoOpCacheManeger it still adds this to cache

```auto
"getNoOpCacheManager": {
      "caches": {
        "oauth-2-clients": {
          "target": "org.springframework.cache.support.NoOpCache"
        }
      }

```
