Announcement Announcement Module
Collapse
No announcement yet.
Catching BeanCreationException on an autowired struts action Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Catching BeanCreationException on an autowired struts action

    Hello,

    For a web application, I'm using Struts 2 and Spring 2.5.
    I defined a struts action which reffered a business service.
    this service is autowired in the action.

    Code:
    <bean id="logElfService" class="...LogElfServiceImpl" init-method="validateParameters" scope="prototype" >
        <constructor-arg value="${elf.server.host}"></constructor-arg>
        <constructor-arg value="${elf.server.port}"></constructor-arg>
    </bean>
    The validateParameters method is used as init method and can throw an exception in case of invalid parameters.

    I added a struts interceptor to catch all exceptions and redirect them in an error page. Unfortunately, I can't catch this exception. My stuts global-exception-mapping doesn't nor.

    Is there a way to catch init-method exceptions on autowired bean ?

    thanks,

    Emmanuel.
Working...
X