Hello,
I created a spring boot application to create an out-of-process application using rest api.
But it failed to run because the missing of the bean NodesApi by displaying the following error message.
Consider defining a bean of type 'org.alfresco.core.handler.NodesApi' in your configuration.
I followed the documentation https://docs.alfresco.com/content-services/latest/develop/oop-ext-points/rest-api-java-wrapper/#list...
I initialized the NodesApi with the @Autowired Spring annotation and here is my code :
package com.arondor.alfrescooutofprocessrestapi; import org.alfresco.core.handler.NodesApi; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class AlfrescoOutOfProcessRestapiApplication implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(AlfrescoOutOfProcessRestapiApplication.class, args); } @Autowired NodesApi nodesApi; @Override public void run(String... args) throws Exception { // Some code here. } }
And here are the dependencies in my pom.xml file.
<properties> <java.version>17</java.version> <alfresco.api.version>5.2.2</alfresco.api.version> </properties> <repositories> <repository> <id>alfresco-public</id> <url>https://artifacts.alfresco.com/nexus/content/groups/public</url> </repository> </repositories> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/org.alfresco/alfresco-acs-java-rest-api-spring-boot-starter --> <dependency> <groupId>org.alfresco</groupId> <artifactId>alfresco-acs-java-rest-api-spring-boot-starter</artifactId> <version>${alfresco.api.version}</version> </dependency> <!-- https://mvnrepository.com/artifact/org.alfresco/alfresco-apa-java-rest-api-spring-boot-starter --> <dependency> <groupId>org.alfresco</groupId> <artifactId>alfresco-apa-java-rest-api-spring-boot-starter</artifactId> <version>${alfresco.api.version}</version> </dependency> <!-- https://mvnrepository.com/artifact/org.alfresco/alfresco-java-event-api-spring-boot-starter --> <dependency> <groupId>org.alfresco</groupId> <artifactId>alfresco-java-event-api-spring-boot-starter</artifactId> <version>${alfresco.api.version}</version> </dependency> </dependencies>
Best regards.
You may try adding configuration with @EnableAutoConfiguration, like in this sample:
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.