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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:51:49+00:00 2026-06-05T18:51:49+00:00

I have a question with respect to Spring , please excuse if my Question

  • 0

I have a question with respect to Spring , please excuse if my Question is a dumb one .
Please see this code

public class HomePageController extends AbstractController {

        private GeekNewsService service;

      protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServletResponse res) throws Exception {
      List<NewsArticle> articles = service.getArticleOverviews();
      return new ModelAndView( "home", "articles", articles );
     }

    public void setGeekNewsService( GeekNewsService service ) {
      this.service = service;
   }

}

Here my question is that , inside the handleRequestInternal Method , why there wasn’t any NullPointerException at this line service.getArticleOverviews() ?? ( Because the actual Object Creation will happen with the help of SetterInjection at setMethod )??

Is there any rule in Spring that , when a class has been called the setXXX Methods must be invoked at first ??

  • 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-06-05T18:51:51+00:00Added an answer on June 5, 2026 at 6:51 pm

    Yes, this is the basic contract Spring is giving to you: before it returns any bean you are guaranteed that this bean is initialized based on your configuration. In other words you will never be capable of calling any business method of any bean prior to full initialization of that bean (setter injection, field injection, post construction callbacks).

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

Sidebar

Related Questions

With respect to this question , is it always necessary to have perfectly concurrent-safe
I have question. I have some app on facebook and getting this error Fatal
I have question i.e how can i select a previous div CODE:- if($i >
I have question regarding the SQLAlchemy. How can I add into my mapped class
Hi i have a following question. According to spring docs tx:annotation-driven only respects bean
I have posted this question at MathOverflow.com as well. I am no mathematician and
I am new to Ruby . I have a question with respect to using
My question is very similar to this one Not drawing outside bounds when clipToBounds=NO
This is not a specific code-based question. I'm looking for some intuition here with
I have posted a question on here previously asking similar advise, but this project

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.