Can't load Spring context in Talend ESB Runtime

One Star

Can't load Spring context in Talend ESB Runtime

What I am doing: I'm using an external JAR library made with Spring, through a tJavaFlex component. I've created a Routine with my own method and library that is loading my application context this way:
public String customMethod(){
ApplicationContext ap = new ClassPathXmlApplicationContext("classpath:/META-INF/spring/application-context.xml");
CustomInterface test = (CustomInterface) ap.getBean("customClass");

return test.businessMethod();
}

My application-context.xml looks like this one:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
      xmlns:xsi=""
      xmlns:context=""
      xmlns:mvc=""
      xsi:schemaLocation="
                         
                          ">
   <!-- Spring IoC Context -->
   <context:component-scan base-package="com.test" />
   <import resource="root-config.xml" />
   <import resource="classpath:/root-context.xml" />
   <!-- Enables the Spring MVC @Controller programming model -->
   <mvc:annotation-driven />
</beans>

the tJavaFlex component is inside a Job that is called from a Route.
If I run this on my Talend Open Studio ESB it works.
My problem: from the mediation perspective, I right-click on my route and build it, so I can deploy inside my Runtimefolder/container/deploy.
But when I use my route from my container it doesn't work! It looks like it can't load the application-context.xml file, giving me an exception like it can't find a bean named "customClass".
Is it because the "classpath" is differend in the built kar file? How can I fix this?
One Star

Re: Can't load Spring context in Talend ESB Runtime

Route already contains own Spring config (Spring view at Mediation perspective). You can extend it as you wish.
One Star

Re: Can't load Spring context in Talend ESB Runtime

Route already contains own Spring config (Spring view at Mediation perspective). You can extend it as you wish.

I'm using a Routine not a Route...

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

An API-First Approach to Modernizing Applications

Learn how to use an API-First Approach to Modernize your Applications

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read