• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Supressing "Failed to import bean definitions"

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. We tried to change authentication/authorization in our web aplication. We ended with with overriding a few beans and it works OK. We would like to have this feature optional - the xml configuration with overriden beans file will (or won't) exist outside application. Application context points to this config file this way:

<import resource="file:${CATALINA_HOME}/conf/externalAuthentication.xml"/>

Buf one imperfection still remains - the file is required to exist. When it doesn't, the loading of application context generates "Failed to import bean definitions..."
Can this error be somehow supressed? Thanks.
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try use wild card matching instead I am not sure if it follows the same rules as far as generating an error if its not found

<import resource="classpath:com/company/**/dao.xml"/>

Your other option if you are using 3.1 is to use bean profiles. Assuming the file will only be present in certain environments you can just define those beans within a bean profile.

http://blog.springsource.org/2011/02/14/spring-3-1-m1-introducing-profile/
http://blog.springsource.com/2011/02/11/spring-framework-3-1-m1-released/
 
Jiri Nejedly
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, the first solution seems to work ok.
 
reply
    Bookmark Topic Watch Topic
  • New Topic