我正在尝试部署Map Portlet,这是一个Spring MVC框架工作。部署时出现错误,如下所示。
13:57:25,966 ERROR [org.springframework.web.portlet.DispatcherPortlet] (ServerService Thread Pool -- 146) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mapViewController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.jasig.portlet.maps.mvc.portlet.MapViewController.setMapDao(org.jasig.portlet.maps.dao.IMapDao); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.jasig.portlet.maps.dao.IMapDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.web.portlet.FrameworkPortlet.createPortletApplicationContext(FrameworkPortlet.java:356) [spring-webmvc-portlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.web.portlet.FrameworkPortlet.initPortletApplicationContext(FrameworkPortlet.java:294) [spring-webmvc-portlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.web.portlet.FrameworkPortlet.initPortletBean(FrameworkPortlet.java:268) [spring-webmvc-portlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.web.portlet.GenericPortletBean.init(GenericPortletBean.java:120) [spring-webmvc-portlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at javax.portlet.GenericPortlet.init(GenericPortlet.java:133) [portlet-api-2.0.jar:]
at org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl.initPortlet(PortletContainerImpl.java:441) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:296) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.PortletContainerLifeCycle.invokeStart(PortletContainerLifeCycle.java:99) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.LifeCycle.promote(LifeCycle.java:146) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.LifeCycle.promote(LifeCycle.java:107) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.PortletFilterLifeCycle.promoteDependents(PortletFilterLifeCycle.java:86) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.LifeCycle.promote(LifeCycle.java:115) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.PortletApplicationLifeCycle.promoteDependents(PortletApplicationLifeCycle.java:349) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.LifeCycle.promote(LifeCycle.java:115) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.LifeCycle.managedStart(LifeCycle.java:72) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.deployment.PortletApplicationDeployment.install(PortletApplicationDeployment.java:150) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.deployment.PortletApplicationDeployer.add(PortletApplicationDeployer.java:199) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.exoplatform.portal.pc.ExoKernelIntegration.onEvent(ExoKernelIntegration.java:207) [exo.portal.component.pc-3.6.3.Final-redhat-4.jar:3.6.3.Final-redhat-4]
at org.gatein.wci.ServletContainer.safeFireEvent(ServletContainer.java:319) [wci-wci-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.gatein.wci.ServletContainer.fireEvent(ServletContainer.java:338) [wci-wci-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.gatein.wci.ServletContainer.access$400(ServletContainer.java:56) [wci-wci-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.gatein.wci.ServletContainer$RegistrationImpl.registerWebApp(ServletContainer.java:462) [wci-wci-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.gatein.wci.jboss.JB7ServletContainerContext.start(JB7ServletContainerContext.java:369) [wci-jboss7-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.gatein.wci.jboss.JB7ServletContainerContext.lifecycleEvent(JB7ServletContainerContext.java:223) [wci-jboss7-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:115) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3772) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_65]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_65]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.jasig.portlet.maps.mvc.portlet.MapViewController.setMapDao(org.jasig.portlet.maps.dao.IMapDao); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.jasig.portlet.maps.dao.IMapDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
... 45 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.jasig.portlet.maps.dao.IMapDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:924) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:793) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:551) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
... 47 more
13:57:25,968 ERROR [org.gatein.pc.portlet.impl.container.LifeCycle] (ServerService Thread Pool -- 146) Cannot promote object to STARTED: org.gatein.pc.portlet.container.PortletInitializationException: The portlet map threw a runtime exception during init
at org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:312) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.PortletContainerLifeCycle.invokeStart(PortletContainerLifeCycle.java:99) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.LifeCycle.promote(LifeCycle.java:146) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.LifeCycle.promote(LifeCycle.java:107) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.PortletFilterLifeCycle.promoteDependents(PortletFilterLifeCycle.java:86) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.LifeCycle.promote(LifeCycle.java:115) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.PortletApplicationLifeCycle.promoteDependents(PortletApplicationLifeCycle.java:349) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.LifeCycle.promote(LifeCycle.java:115) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.container.LifeCycle.managedStart(LifeCycle.java:72) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.deployment.PortletApplicationDeployment.install(PortletApplicationDeployment.java:150) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.deployment.PortletApplicationDeployer.add(PortletApplicationDeployer.java:199) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.exoplatform.portal.pc.ExoKernelIntegration.onEvent(ExoKernelIntegration.java:207) [exo.portal.component.pc-3.6.3.Final-redhat-4.jar:3.6.3.Final-redhat-4]
at org.gatein.wci.ServletContainer.safeFireEvent(ServletContainer.java:319) [wci-wci-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.gatein.wci.ServletContainer.fireEvent(ServletContainer.java:338) [wci-wci-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.gatein.wci.ServletContainer.access$400(ServletContainer.java:56) [wci-wci-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.gatein.wci.ServletContainer$RegistrationImpl.registerWebApp(ServletContainer.java:462) [wci-wci-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.gatein.wci.jboss.JB7ServletContainerContext.start(JB7ServletContainerContext.java:369) [wci-jboss7-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.gatein.wci.jboss.JB7ServletContainerContext.lifecycleEvent(JB7ServletContainerContext.java:223) [wci-jboss7-2.3.1.Final-redhat-3.jar:2.3.1.Final-redhat-3]
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:115) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3772) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_65]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_65]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mapViewController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.jasig.portlet.maps.mvc.portlet.MapViewController.setMapDao(org.jasig.portlet.maps.dao.IMapDao); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.jasig.portlet.maps.dao.IMapDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.web.portlet.FrameworkPortlet.createPortletApplicationContext(FrameworkPortlet.java:356) [spring-webmvc-portlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.web.portlet.FrameworkPortlet.initPortletApplicationContext(FrameworkPortlet.java:294) [spring-webmvc-portlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.web.portlet.FrameworkPortlet.initPortletBean(FrameworkPortlet.java:268) [spring-webmvc-portlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.web.portlet.GenericPortletBean.init(GenericPortletBean.java:120) [spring-webmvc-portlet-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at javax.portlet.GenericPortlet.init(GenericPortlet.java:133) [portlet-api-2.0.jar:]
at org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl.initPortlet(PortletContainerImpl.java:441) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
at org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:296) [pc-portlet-2.4.2.Final-redhat-2.jar:2.4.2.Final-redhat-2]
... 28 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.jasig.portlet.maps.mvc.portlet.MapViewController.setMapDao(org.jasig.portlet.maps.dao.IMapDao); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.jasig.portlet.maps.dao.IMapDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
... 45 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.jasig.portlet.maps.dao.IMapDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:924) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:793) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:551) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
... 47 more
他们是一个@Autowired for RestfulJsonMapDaoImpl类,它有一个接口类IMapDao。
控制器类
package org.jasig.portlet.maps.mvc.portlet;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.portlet.*;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jasig.portlet.maps.dao.IMapDao;
import org.jasig.portlet.maps.model.xml.DefaultLocation;
import org.jasig.portlet.maps.model.xml.MapData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.portlet.ModelAndView;
import org.springframework.web.portlet.bind.annotation.ResourceMapping;
@Controller
@RequestMapping("VIEW")
public class MapViewController {
public static final String PREFERENCE_API_KEY = "apiKey";
final protected Log log = LogFactory.getLog(getClass());
private IMapDao dao;
@Autowired(required = true)
public void setMapDao(IMapDao dao) {
this.dao = dao;
}
RestfulJsonMapDaoImpl类
@Component()
public class RestfulJsonMapDaoImpl implements IMapDao {
final protected Log log = LogFactory.getLog(getClass());
private RestTemplate restTemplate;
@Autowired(required = true)
public void setRestTemplate(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
IMapDao
public interface IMapDao {
public MapData getMap(String location);
}
application.xml文件
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
<property name="messageConverters">
<util:list>
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"/>
<bean class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter"/>
</util:list>
</property>
</bean>
<bean class="org.jasig.portlet.maps.dao.RestfulJsonMapDaoImpl" p:restTemplate-ref="restTemplate"/>
我不知道我哪里出错了,但错误是连续不断的。如果有人提前解决了这个问题,那对我有很大的帮助。
答案 0 :(得分:1)
我认为您在application.xml
中的代码段下面缺少<mvc:annotation-driven />
以及servlet上下文中的相应命名空间。
答案 1 :(得分:1)
您在标记
中定义的包中的Spring搜索bean<context:component-scan base-package="org.jasig.portlet" />
由于标签
,它可以使用@Controller或@RequestMapping等注释<mvc:annotation-driven />
我认为你需要两者:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
...
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context ...">
...
<context:component-scan base-package="org.jasig.portlet" />
<mvc:annotation-driven />
...
</beans>
答案 2 :(得分:0)
尝试允许Spring躲避您的包裹以便自动装配:
您的application.xml应包含:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
...
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context ...">
...
<context:component-scan base-package="org.jasig.portlet" />
...
</beans>
答案 3 :(得分:0)
尝试在applicationContext xml文件中使用它。组件扫描应该是您的根包。
<context:component-scan base-package="org.jasig" />