Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6322943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:25:34+00:00 2026-05-24T16:25:34+00:00

Spring 3.1 + Tomcat I have a bit of a design question here: There

  • 0

Spring 3.1 + Tomcat

I have a bit of a design question here:

There are a group of categories that have been specified in a database. These categories can be considered global in the sense that they could be used throughout the webapp. What I would like to do is read these categories on server startup and populate some type of collection in Java. The only need to be read from the database once at startup, consider it a type of initialization.

Two options I can think of:

1) Should I use a NON lazily initialized bean?

or

2) Modifying the web.xml?

I’m not really sure what is the preferred method, and any instructions on how to perform your recommended would be much appreciated. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:25:35+00:00Added an answer on May 24, 2026 at 4:25 pm

    Options you have provided are most commonly used:

    1. Use singleton non-lazy bean with a method annotated with @PostConstruct (but be aware that @Transactional might not work). You can have several beans with such initialization routine.

    2. Extend org.springframework.web.context.ContextLoaderListener and use it in web.xml. I find this solution less elegant and also promoting bad programming style (extending with call to super to enhance the base class)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Spring MVC project that I've been deploying to Tomcat (installed both
I have a web application made with Spring that runs on Tomcat. On the
I'm building a Route Planner Webapp using Spring/Hibernate/Tomcat and a mysql database, I have
I have a very large problem. I've written a large app using Flex3/Tomcat/BlazeDS/Spring that
I have a Spring/Hibernate web application (currently working fine on Tomcat) that I am
I have a tomcat - spring mvc - jsp application. I have discovered that
I have a RESTful service using Jersey/Spring/Tomcat. My question is - is it possible
I have numerous Spring Framework-based applications that run on a Tomcat 5.5 server. Some
I have web application - use Spring + Tomcat. I need debug method that
Background: I have a Spring 2.5/Java/Tomcat application. There is the following bean, which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.