Appian Services Injection in Plugin Servlets

Hello all,

I'm trying to develop a plug-in servlet for Appian 17.2 and i need access to various services (e.g. ProcessExecutionService, ProcessDesignService). The class ServiceLocator is deprecated and Appian suggests to use injection (with the @Injection annotation) as in SmartService plugins.

However, there's not proper documentation for implementing that and all examples of Appian use the deprecated ServiceLocator class.

Since custom servlets extend the AppianServlet class (as per Appian instructions) then autowiring is enabled for custom servlets. But i'm unable to get it work.

I have added the following code in the custom servlet class

@Injection ProcessDesignService pds;

However, at run-time i get an exception from the Spring framework indicating that no unique bean was found for the ProcessDesignService injection.

Has anyone implemented @Injection in custom servlets?

  Discussion posts and replies are publicly visible

Parents
  • Not possible, you will have to use the deprecated class for now.
    What is your use case? Could you use web apis instead?
  • The use case is initiating Processes that are exposed as Web Services with the addition of returning data in the response and not just the generated Process ID. Unfortunately, we are not able to switch to web apis just yet because we're in the process of upgrading our 7.6 installation to 17.2, which will take place by the end of November. We are working on Lab environment which was a copy of our 7.6 production and upgraded to 17.2 and we are working fixing any issues resulting from the Upgrade.

    This custom servlet is one case where an issue came up and while redeveloping we wanted to switch to using @Injection instead of deprecated classes.

    The funny thing is that in the documentation of Appian Public Java API, it mentions that all custom servlets should extend the AppianServlet class in order to support @Injection. However, there is examples of such use.

    public abstract class AppianServlet extends HttpServlet

    Abstract servlet class that provide inject functionality. To have services injected into servlets, plugin servlets will be written to extend this class and add @Inject annotation for the services to be injected.

    public void init()
              throws ServletException
    servlet init() method that locates the web application context and autowires services with @Inject annotations. Note that the `init()` method on the AppianServlet class initializes the injectors.
Reply
  • The use case is initiating Processes that are exposed as Web Services with the addition of returning data in the response and not just the generated Process ID. Unfortunately, we are not able to switch to web apis just yet because we're in the process of upgrading our 7.6 installation to 17.2, which will take place by the end of November. We are working on Lab environment which was a copy of our 7.6 production and upgraded to 17.2 and we are working fixing any issues resulting from the Upgrade.

    This custom servlet is one case where an issue came up and while redeveloping we wanted to switch to using @Injection instead of deprecated classes.

    The funny thing is that in the documentation of Appian Public Java API, it mentions that all custom servlets should extend the AppianServlet class in order to support @Injection. However, there is examples of such use.

    public abstract class AppianServlet extends HttpServlet

    Abstract servlet class that provide inject functionality. To have services injected into servlets, plugin servlets will be written to extend this class and add @Inject annotation for the services to be injected.

    public void init()
              throws ServletException
    servlet init() method that locates the web application context and autowires services with @Inject annotations. Note that the `init()` method on the AppianServlet class initializes the injectors.
Children
No Data