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

  • Home
  • SEARCH
  • 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

I have a question related to this one . I don't want to do
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
My question is very similar to this one Not drawing outside bounds when clipToBounds=NO
I have a question with respect to putting JSON data into a table view.
I have posted a question on here previously asking similar advise, but this project
This is a MySQL question: I have a table with the following structure. reference
My question is in fact this: I know how to manipulate the code from
I have this question for quite a long time... I have seen many discussions

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.