Skip to content

Commit

Permalink
Use default producer of JCache
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrinot committed Oct 6, 2016
1 parent c00ab5e commit 53a0859
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 74 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package io.microprofile.showcase.schedule.persistence;

import io.microprofile.showcase.bootstrap.BootstrapData;
import io.microprofile.showcase.schedule.cdi.ScheduleCache;
import io.microprofile.showcase.schedule.model.Schedule;
import io.microprofile.showcase.schedule.model.adapters.LocalDateAdapter;
import io.microprofile.showcase.schedule.model.adapters.LocalTimeAdapter;
Expand Down Expand Up @@ -45,10 +44,8 @@
public class ScheduleDAO {

@Inject
@ScheduleCache

This comment has been minimized.

Copy link
@jerrinot

jerrinot Oct 6, 2016

Author Owner

I don't have to use the @ScheduleCache qualifier anymore and the producer associated to it.
Boilerplate is gone. That's the main benefit here.

private Cache<LongKey, Schedule> scheduleCache;


@Inject
BootstrapData bootstrapData;

Expand Down Expand Up @@ -123,7 +120,7 @@ public Schedule updateSchedule(Schedule schedule) {



@CacheRemove(cacheName="schedule", cacheKeyGenerator = LongKeyGenerator.class)
@CacheRemove(cacheKeyGenerator = LongKeyGenerator.class)
public void deleteSchedule(Long scheduleId) {
// if (scheduleId != null) {
// scheduleCache.remove(new MyKey(scheduleId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.microprofile.showcase.schedule.resources;

import io.microprofile.showcase.schedule.cdi.CacheProducer;
import io.microprofile.showcase.schedule.model.Schedule;
import io.microprofile.showcase.schedule.persistence.ScheduleDAO;
import io.microprofile.showcase.schedule.rest.Application;
Expand Down Expand Up @@ -69,7 +68,6 @@ public static WebArchive createDeployment() {

return ShrinkWrap.create(WebArchive.class, "schedule-microservice.war")
.addPackage(Schedule.class.getPackage())
.addPackage(CacheProducer.class.getPackage())
.addClasses(ScheduleResource.class, ScheduleDAO.class, Application.class)
.addAsLibraries(bootstrapLib);
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
<dependency>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-embedded-all</artifactId>
<version>4.1.1.163.0.1</version>
<version>4.1.1.164-SNAPSHOT</version>
</dependency>


Expand Down

1 comment on commit 53a0859

@gregrluck
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this ScheduleDAO @CacheDefaults is already being declared at the class level. i.e.

@ApplicationScoped
@CacheDefaults(cacheName = "schedule")
public class ScheduleDAO {
...
}

So this change means that we don't need to keep using the cacheName on individual annotations which is why @CacheDefaults was added to the spec in the first place.

Please sign in to comment.