我想在带有注释的 liferay 7.2 中使用 spring-core @Autowired。所以,我有下一个 portlet
package com.aimprosoft.module;
import com.aimprosoft.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import java.io.IOException;
public class SamplePortlet extends GenericPortlet {
@Autowired
private EmployeeService employeeService;
@Override
protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
response.getWriter().println(employeeService.toString());
}
}
那么,我必须在 web.xml 或 portlet.xml 中做什么来设置 spring-core 的上下文侦听器?例如在 web-servlet 应用程序中我必须添加
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
江户川乱折腾
相关分类