Been searching around for clues how to do this, without writing custom implementations.
I have application xml like this:
pointing to a properties file withHTML Code:<context:annotation-config/> <context:component-scan base-package="blah"/> <context:property-placeholder location="classpath:application.properties"/>
I have a groovy controller like this.HTML Code:application.propertyIWant=blahblah
Code:package blah import javax.annotation.Resource; import org.springframework.stereotype.* import org.springframework.beans.factory.annotation.* import org.springframework.ui.ModelMap import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestParam interface FrontController { def landingPage(ModelMap model) } @Controller @RequestMapping([ "/*.*" ]) class FrontControllerImpl extends AbstractController implements FrontController{ @Resource(name="application.propertyIWant") String propertyIWant; @RequestMapping(["/index.html"]) def landingPage(ModelMap model){ return "index" } }
But it wont work , as it wont be able to resolve the Resource of type or name application.propertyIWant
Any ideas how to inject Resource configurations from property placeholders?
Without write a bean xml for the class?


Reply With Quote
