cancel
Showing results for 
Search instead for 
Did you mean: 

How to initialize alfresco-core-rest-api from Spring MVC app via @ComponentScan

arnieHHS
Champ in-the-making
Champ in-the-making

This link https://docs.alfresco.com/content-services/latest/develop/oop-sdk/

Shows a very terse Sdk5DemoApplication to start up a RESTful listener against a repo. I want to add ECM functionality to a multi-module EAR and want to isolate all that code to a new module (a spring jar).

I have added said jar's root package to the application's @ComponentScan list of packages. But how do I tell Spring to find (aka scan) the Alfresco API beans?

The documentation is very vague as to what is being scanned/initialized. Specifically in regards to this: @Autowired SitesApi sitesApi; Which implies there's a SitesApiImpl somewhere to be instantiated. Will scanning be enough or will a @PostConstruct method also be necessary?

 

1 ACCEPTED ANSWER
11 REPLIES 11

arnieHHS
Champ in-the-making
Champ in-the-making

So, the published alfresco-core-rest-api.jar and all the others all include io.swagger.configuration which is not allowable when using JDK 9+ (I'm on 17). Which I found at:

https://mvnrepository.com/artifact/org.alfresco/alfresco-core-rest-api

Are there versions of these libraries with OUT the swagger package?

arnieHHS
Champ in-the-making
Champ in-the-making

Also, this library needs the following properties set up:

-Dcontent.service.url=https://localhost:8443
-Dcontent.service.path=content
-Dauthentication.service.path=auth

Putting these in a properties file in the root of the JAR, and adding the follow annotation to the top of a configuration class:

 

@Configuration
@PropertySource("classpath:alfresco.properties")
@Import(FeignAutoConfiguration.class)
@EnableFeignClients(basePackages = {
"org.alfresco.authentication.handler",
"org.alfresco.core.handler",
"org.alfresco.discovery.handler",
"org.alfresco.model.handler",
"org.alfresco.search.handler",
"org.alfresco.search.sql.handler"
})

Does NOT work. No idea why. Had to add them to the server start up, which is not ideal or valid.