Announcement Announcement Module
No announcement yet.
Implementing a new protocol on Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Implementing a new protocol on

    I am testing the script groovy support.
    I know it use the Resource support to be able to load the resouces from the filesystem or the classpath.
    But I need make possible to load the script files from a database. So I need to create database protocol :

    <constructor-arg index="0"><value>database:/tmp/CalculoSub.groovy</value></constructor-arg>

    How I will implement this generic resource support ?

  • #2
    The Resource interface is generic, but the classes in Spring are not set up such that this is a pluggable protocol setup similar to the way URLs are handled for example. The actual text strings you entrer in an appcontext get converted to a Resoure via a ResourceEditor PropertyEditor that gets registered automatically, and this will ultimately end up using DefaultResourceLoader, which ends up creating Resources of type ClassPathResource or UrlResource. If you can register a standrd type URL handler in your environment which can handle a custom database prefix, that might be one approach.

    I would instead however first look at basing something off JdbcBeanDefinitionReader, for reading bean definitions from a db...