Home Grails 3.3 - How to replace deprecated Service artefact?
Reply: 1

Grails 3.3 - How to replace deprecated Service artefact?

ilPittiz
1#
ilPittiz Published in 2018-02-01 09:43:30Z

I'm about to upgrade my Grails 3.2 web-app to version 3.3.

In particular, I created a BaseService abstract class (located in /src/groovy) providing several helper methods, and most of all my Grails services extend BaseService.

import grails.artefact.Service

abstract class BaseService implements Service {
    ...
}

I noticed that with Grails 3.3 grails.artefact.Service was deprecated, along with its superclass grails.events.Events.

What can I use in place of Service to avoid keeping references to deprecated classes?

Mamun Sardar
2#
Mamun Sardar Reply to 2018-02-04 18:46:40Z

The deprecation is because of New Events API and Async Framework. If you read the documentation of grails 3, you can find:

In order to support multiple different asynchronous and reactive frameworks Grails 3.3 has been decoupled from Reactor 2.x and an abstract EventBus notation added.

The EventBus interface provides the foundation and multiple implementations including GPars and RxJava.

A new set of annotations usable in services classes and regular Spring beans can be leveraged to publish and consume events:

Publisher - A transformation that transforms a method ensuring the return value is published as an event

Subscriber - A transformation that transforms a method to listen for an event.

So if your implements Service was for using Events, then you've to update your events implementation using grails 3 async and events plugin. Check out the Async framework documentation #events part.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.874584 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO