SHARE
TWEET

Untitled

a guest Nov 14th, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <mvc:resources mapping="/BasePlu/**" location="classpath:/static/BasePlu/" />
  2. <mvc:resources mapping="/Lib/**" location="classpath:/static/Lib/" />
  3.  
  4. <bean id="natureRepository" class="com.autumnframework.blog.repository.NatureRepositoryImpl">
  5. </bean>
  6.    
  7. public static void main(String[] args) {
  8.     ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
  9.             "classpath:/spring/spring-mvc.xml");
  10.  
  11.     Repository repository = context.getBean(NatureRepositoryImpl.class);
  12.     System.out.println("4. " + repository.getAllObjects());
  13. }
  14.    
  15. Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0': Invocation of init method failed; nested exception is java.lang.IllegalStateException: WebApplicationObjectSupport instance [ResourceHttpRequestHandler [locations=[class path resource [static/BasePlu/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@43bd930a]]] does not run in a WebApplicationContext but in: org.springframework.context.support.ClassPathXmlApplicationContext@1a86f2f1: startup date [Wed Nov 15 10:31:23 CST 2017]; root of context hierarchy
  16. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1589)
  17. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:554)
  18. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
  19. at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
  20. at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
  21. at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
  22. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
  23. at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759)
  24. at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
  25. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
  26. at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
  27. at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
  28. at Test.main(Test.java:26)
  29. Caused by: java.lang.IllegalStateException: WebApplicationObjectSupport instance [ResourceHttpRequestHandler [locations=[class path resource [static/BasePlu/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@43bd930a]]] does not run in a WebApplicationContext but in: org.springframework.context.support.ClassPathXmlApplicationContext@1a86f2f1: startup date [Wed Nov 15 10:31:23 CST 2017]; root of context hierarchy
  30. at org.springframework.web.context.support.WebApplicationObjectSupport.getWebApplicationContext(WebApplicationObjectSupport.java:112)
  31. at org.springframework.web.context.support.WebApplicationObjectSupport.getServletContext(WebApplicationObjectSupport.java:128)
  32. at org.springframework.web.servlet.resource.ResourceHttpRequestHandler.initContentNegotiationStrategy(ResourceHttpRequestHandler.java:306)
  33. at org.springframework.web.servlet.resource.ResourceHttpRequestHandler.afterPropertiesSet(ResourceHttpRequestHandler.java:268)
  34. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1648)
  35. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1585)
  36. ... 12 more
  37.    
  38. <!--<mvc:resources mapping="/BasePlu/**" location="classpath:/static/BasePlu/" />-->
  39. <!--<mvc:resources mapping="/Lib/**" location="classpath:/static/Lib/" />-->
  40.  
  41. <bean id="natureRepository" class="com.autumnframework.blog.repository.NatureRepositoryImpl">
  42. </bean>
RAW Paste Data
Top