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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:19:21+00:00 2026-05-28T06:19:21+00:00

I have a request scoped bean, and I need to have access to the

  • 0

I have a request scoped bean, and I need to have access to the HttpServletResponse and HttpServletRequest objects.

I need access to these objects in the constructor, so property autowiring is not an option.

I did the following:

@Component
@Scope("request")
public class MyClass{

    @Autowired(required=true)
    public MyClass(HttpServletRequest request, HttpServletResponse response) {

        // do stuff I need to do in the constructor

    }
}

This gives me the following error:

No default constructor found; nested exception is java.lang.NoSuchMethodException: com.foo.bar.MyClass.()

According to this error message, it is looking for a paramless default constructor, which does not exist. I autowired the constructor and specifically set “required” to true, so the injector should choose this constructor. Since the bean is request scope this should work, but it does not.

Any ideas?

  • 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-28T06:19:22+00:00Added an answer on May 28, 2026 at 6:19 am

    As far as I understand , you will not be able to autowire the HttpServletResponse object using the standard approach . Check the registerWebApplicationScopes method of the WebApplicationContextUtils class . The resolvable dependencies are only the HttpSession.class and HttpSession.class .

    Check for a cusom solution here .

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

Sidebar

Related Questions

I have two drop downs on a page whose backing bean is Request Scoped.
I have a request scoped CDI manage bean(Also tried with jsf managed bean but
I have problem pertaining to the maintaining state of the particular @Request scope bean.
I have request where i need to change grid formatting on drop down action
I have linq request. I need get item.Title in select. how do this? var
I have a jsf page having a request scope bean. A slow database query
Assume I have a session scoped bean with object references in it, where the
i am working on jsf 1.2 application. i have kept bean in request scope
Say I have a JSF backing bean, request scope, that has a List as
I have a simple request scoped entity / pojo which has a Enum and

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.