Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Spring Petclinic
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Miles Budden
Spring Petclinic
Commits
f78ee5d7
Commit
f78ee5d7
authored
8 years ago
by
Antoine Rey
Browse files
Options
Downloads
Patches
Plain Diff
Using the @CacheResult JSR-107 JCache annotation
parent
6ff35b6c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java
+6
-10
6 additions, 10 deletions
...ramework/samples/petclinic/service/ClinicServiceImpl.java
with
6 additions
and
10 deletions
src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java
+
6
−
10
View file @
f78ee5d7
...
...
@@ -15,16 +15,9 @@
*/
package
org.springframework.samples.petclinic.service
;
import
java.util.Collection
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.samples.petclinic.model.Owner
;
import
org.springframework.samples.petclinic.model.Pet
;
import
org.springframework.samples.petclinic.model.PetType
;
import
org.springframework.samples.petclinic.model.Vet
;
import
org.springframework.samples.petclinic.model.Visit
;
import
org.springframework.samples.petclinic.model.*
;
import
org.springframework.samples.petclinic.repository.OwnerRepository
;
import
org.springframework.samples.petclinic.repository.PetRepository
;
import
org.springframework.samples.petclinic.repository.VetRepository
;
...
...
@@ -32,9 +25,12 @@ import org.springframework.samples.petclinic.repository.VisitRepository;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.cache.annotation.CacheResult
;
import
java.util.Collection
;
/**
* Mostly used as a facade for all Petclinic controllers
* Also a placeholder for @Transactional and @Cache
able
annotations
* Also a placeholder for @Transactional and @Cache
Result
annotations
*
* @author Michael Isvy
*/
...
...
@@ -100,7 +96,7 @@ public class ClinicServiceImpl implements ClinicService {
@Override
@Transactional
(
readOnly
=
true
)
@Cache
able
(
valu
e
=
"vets"
)
@Cache
Result
(
cacheNam
e
=
"vets"
)
public
Collection
<
Vet
>
findVets
()
throws
DataAccessException
{
return
vetRepository
.
findAll
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment