Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to creaate ApplicationContext for a jar?

Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think ApplicationContext should only create once and then use it to getBean, again, I see many example in Web which create applicationcontext in the main method

But for my case, it is packed as a jar and no main method, it is just called by a webapp and not a standalone application, then where should I create ApplicationContext for this jar?
I think it is not good to create applicationcontext each time I need getBean, right?
Posts: 1682
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring will look in jars too as long as its in the classpath. Use the ContextLoader in the web.xml to load it from the jar in addition to any contexts in the web-app.

Or to avoid time scanning declare them explicitly

You got style baby! More than this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic