Message Boards

Liferay 7.2 portal with spring-core issue

матвей чебукин, modified 4 Years ago.

Liferay 7.2 portal with spring-core issue

New Member Posts: 2 Join Date: 7/11/19 Recent Posts
Hi everyone
I want to use spring-core in liferay 7.2 with @Autowired annotation. So, i have following portlet


public class SamplePortlet extends GenericPortlet { 
       @Autowired 
       private EmployeeService employeeService; 
       @Override 
       protected void doView(RenderRequest request, RenderResponse response){
             response.getWriter().println(employeeService.toString());
       }
 }
So, what i must to do in web.xml or in portlet.xml to set context listener of spring-core ? For example in web-servlet application i must to add
<listener>
        <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> 
</listener>
thumbnail
David H Nebinger, modified 4 Years ago.

RE: Liferay 7.2 portal with spring-core issue

Liferay Legend Posts: 14916 Join Date: 9/2/06 Recent Posts
For spring mvc use, you have to stick with the legacy war format. Since you have a legacy war, you will also be able to add your context listener.
матвей чебукин, modified 4 Years ago.

RE: Liferay 7.2 portal with spring-core issue

New Member Posts: 2 Join Date: 7/11/19 Recent Posts
Thanks for your reply