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 900209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:20:51+00:00 2026-05-15T15:20:51+00:00

Is it forbidden or not a best practice to create objects using new. Creating

  • 0

Is it forbidden or not a best practice to create objects using new. Creating objects means like Helper objects for some specific tasks that are no way related to the request, but are just used to perform some background tasks like reading a local file, database etc

  • 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-15T15:20:52+00:00Added an answer on May 15, 2026 at 3:20 pm
    1. It’s not forbidden
    2. It’s not a good practice to instantiate stateless components (like helpers), because you are creating unnecessary instances
    3. All spring beans “live” in the application context, and it is the one that instantiates them, not you. So if you want to be able to inject dependencies into your objects, let them be spring-managed – i.e. don’t instantiate with new.
    4. Typically, only value objects (User, Address, AccountInfo, etc) are instantiated by you (using new)
    5. There is some “magic” that allows you to have both dependency injection and instantiation using new. It is the @Configurable annotation. It uses AspectJ weavers that plug to the VM. But it is not something to consider until there are no alternatives. (the last sentence is my opinion)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Accept is not listed in the forbidden headers in the documentation here: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/URLRequestHeader.html but
My page showing error forbidden access error, when I post some html and javascript
within my App it should be forbidden to edit (customize) the TabBar. This means
Using the AndroidHttpClient with cookies gives me intermixed 200 ok and 403 forbidden responses.
I'm probably not supposed to use file_get_contents() What should I use? I'd like to
Why this parameter does not pass: file.php?t=%26quot%3B%26gt%3B%0A%09%09%09%26lt Instead it gives: Forbidden You don't have
Referer checking failed - http://localhost:8000/admin/ does not match https://localhost:8000/ . I'm getting Forbidden when
Is selling of physical goods via Android in-app purchase forbidden or just not recommended?
I'm doing a practice project for training; my handler has specifically forbidden paramaterization and
In some of my projects and in some books was said to not use

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.