diff --git a/generators/spring-boot/templates/src/main/java/_package_/_entityPackage_/service/UserService.java.ejs b/generators/spring-boot/templates/src/main/java/_package_/_entityPackage_/service/UserService.java.ejs index 13ad90292eef..25e1d67733e2 100644 --- a/generators/spring-boot/templates/src/main/java/_package_/_entityPackage_/service/UserService.java.ejs +++ b/generators/spring-boot/templates/src/main/java/_package_/_entityPackage_/service/UserService.java.ejs @@ -54,6 +54,9 @@ import org.slf4j.LoggerFactory; <%_ } _%> <%_ if (cacheProviderAny) { _%> import org.springframework.cache.CacheManager; +<%_ if (databaseTypeCouchbase) { _%> +import org.springframework.cache.annotation.CacheEvict; +<%_ } _%> <%_ } _%> <%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { _%> <%_ if (!reactive) { _%> @@ -573,6 +576,9 @@ public class UserService { .map(<%= user.adminUserDto %>::new); } + <%_ if (databaseTypeCouchbase && cacheProviderAny) { _%> + @CacheEvict(cacheNames = UserRepository.USERS_BY_LOGIN_CACHE, key = "#login") + <%_ } _%> <%_ if (reactive) { _%> <%_ if (databaseTypeSql) { _%> @Transactional