Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <bean id="velocityEngine"
  2. class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
  3. <property name="velocityProperties">
  4. <props>
  5. <prop key="resource.loader">class</prop>
  6. <prop key="class.resource.loader.class">
  7. org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
  8. </prop>
  9. </props>
  10. </property>
  11. </bean>
  12.  
  13. <bean id="vs" class="com.xxx.sp.add.service.Vs">
  14. <constructor-arg ref="velocityEngine" />
  15. </bean>
  16.  
  17. @Controller("Vs")
  18. public class Vs {
  19. private static VelocityEngine velocityEngine;
  20.  
  21. @Autowired
  22. public Vs(VelocityEngine velocityEngine) {
  23. this.velocityEngine = velocityEngine;
  24. }
  25.  
  26. public static VelocityEngine getVelocityEngine() {
  27. return velocityEngine;
  28. }
  29. }
  30.  
  31. VelocityEngine velocityEngine = Vs.getVelocityEngine() ;
  32.  
  33. @RequestMapping(value = "/public/ui/login", method = RequestMethod.GET)
  34. public ModelAndView loginForm() {
  35. ModelAndView mav = new ModelAndView();
  36. mav.addObject("user", new User());
  37. mav.setViewName("addon/public/login.jsp");
  38.  
  39. //velocityEngine = Vs.getVelocityEngine() ;
  40. logger.debug("VelocityEngine located:" + velocityEngine);
  41.  
  42. return mav;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement