Announcement Announcement Module
Collapse
No announcement yet.
Get Resources Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get Resources

    I can obtain a XML bean factory independent of ApplicationContext? Example

    ApplicationContext def..

    beans>

    <!-- Definition if bean ReportFactory -->
    <bean id="reportFactory" class="tgn.util.tld.ReportFactory">
    <constructor-arg>
    <value>reports- spring.xml</value>
    </constructor-arg>
    </bean>


    </beans>

    my XML reports reports- spring.xml

    <beans>

    <!-- Definicion del bean StringParameters -->
    <bean id="stringParamBean" class="report.impl.StringParameter" singleton="false">
    <property name="name"><value>Motocompresor</value></property>
    <property name="id"><value>planta</value></property>
    <property name="value"><value>Algo que decir</value></property>
    <property name="required"><value>true</value></property>
    </bean>

    </bean>


    The file of reports is in the Web-inf directory, but the objective is to load this xml when it is needed not like part of the context

    My Class ReportFactory

    ....
    public ReportFactory(String path){
    this.path = path;
    ClassPathResource res = new ClassPathResource(path);

    factory=new XmlBeanFactory(res);
    }
    ...
    }


    But when loading the application I obtain one exception, of file nonfound in class path

    It is possible to do this?

    Thankz Javier

  • #2
    Hi,
    you have to move your reports file to the WEB-INF/classes dirctory in your webapp.
    Or you just use FileSystemResource with the full path (or relative from TOMCAT_HOME/bin)

    regards,
    Mario

    Comment

    Working...
    X