I have tried dependency injection but, it cannot find my "Apache Sling Connection Pooled DataSource"@referenceprivate DataSourcePool dsp; DataSource ds = (DataSource) dsp.getDataSource("MYDB"); I am using SlingSafeMethodsServlet. Any help would be appreciated.
I figured this out . . . the code was working as expected. I went into configmgr and whitelisted all components and it worked. The code, right or wrong, is working. Now I need to figure out a service account and not use the whitelisting.
I actually got it working with very similar code. It was a permissions thing. I figured out how to whitelist my component but, ultimately I need to set up a service account becasue loginAdministrative() is deprecated. I need to find some easy instructions for a service account.
I have a custom workflow component that needs to look up a User in the AEM User repository. Code is pretty simple:resourceResolver = getResourceResolver(workflowSession);UserManager userManager = resourceResolver.adaptTo(UserManager.class);Iterator<Authorizable> userIterator = userManager.findAuthor...