Message Boards

Inject Spring Bean from external´s jar libraries

Juan Miguel Leal Aragón, modified 3 Years ago.

Inject Spring Bean from external´s jar libraries

Junior Member Posts: 27 Join Date: 10/24/17 Recent Posts

Good Morning

I tried inject spring bean from external´s jar libraries into module project, but I can´t do it.

How I cant do?

Thanks in advanced

thumbnail
Olaf Kock, modified 3 Years ago.

RE: Inject Spring Bean from external´s jar libraries

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts

What have you tried so far, how did it behave, what did you observe and which Liferay version are you referring to? Please provide sample (simplified) code - as it is, it's hard to assume the proper context for this question.    

Juan Miguel Leal Aragón, modified 3 Years ago.

RE: RE: Inject Spring Bean from external´s jar libraries

Junior Member Posts: 27 Join Date: 10/24/17 Recent Posts

Hi Olaf Kock

Version of LIferay is 7.0-GA5

I have a module project A and this contain externar library ext.jar. In this library (ext.jar) I have a Service Class with annotation @Service as follow:

@Service("helloWorldService")
public class HelloWorldService {

I want inject like bean HelloWorldService  in my Util Class in module project A

public class ProjectAUtils {

    @Autowired

    private static HelloWorldService helloWorldService;

 

And in my bnd I have

-includeresource: @ext-0.0.1.jar

When execute my Utils, bean helloWorldService is null. I do multiples search in internet for a solution but I don´t succes

How I can add context spring for my module project A  and inject this bean?

Thanks in advanced