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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:41:41+00:00 2026-06-13T09:41:41+00:00

Pretty simple scenario: I’m using Spring and Spring Security, and I’m trying to inject

  • 0

Pretty simple scenario: I’m using Spring and Spring Security, and I’m trying to inject a property into the AuthenticationProvider used by my AuthenticationManager. I just had the thought that I might be able to wire it up in the applicationContext, but not sure if that would work.

applicationContext.xml:

<http use-expressions="true">
    <intercept-url pattern="/" access="permitAll" />
    <intercept-url pattern="/**" access="hasRole('USER')"/>
    <form-login login-page="/index" />
</http>

<authentication-manager alias="authenticationManager">
    <authentication-provider ref="twitterAuthenticationProvider" />
</authentication-manager>

<beans:bean id="twitterAuthenticationProvider" class="com.bottlingday.model.auth.TwitterAuthenticationProvider" />

TwitterAuthenticationProvider:

public class TwitterAuthenticationProvider implements AuthenticationProvider
{
@Autowired
private AppEngineUserStore userStore;

static Log log = LogFactory.getLog(TwitterAuthenticationProvider.class.getName());

public void Test()
{
            //userStore is always null here
    log.info("test");
}
}

In my controller this fails because userStore is a null ref in TwitterAuthenticationProvider:

Authentication authentication = this.authenticationManager.authenticate(authToken);

Here’s the exact error:

java.lang.NullPointerException
at com.bottlingday.model.auth.TwitterAuthenticationProvider.authenticate(TwitterAuthenticationProvider.java:33)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
at com.bottlingday.auth.TwitterAuthController.OauthCallback(TwitterAuthController.java:129)

Edit: I am using autowiring, and it works fine for other things. If I autowire a AppEngineUserStore in a MVC controller, it will be there every time.

  • 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-13T09:41:42+00:00Added an answer on June 13, 2026 at 9:41 am
    I just had the thought that I might be able to wire it up in the applicationContext, but not sure if that would work.
    

    This would work. You can specify the wiring of your properties in your application context.

    However, this is not the same as autowiring (Which is what you have in your AuthenticationProvider.

    If you wish to autowire your AppEngineUserStore you will need to register it in your application context and turn on autowiring. This can be done as follows:

    <context:annotation-config />
    

    Spring can also scan for beans to autowire if you use:

    <context:component-scan base-package="com.my.package" />
    

    This will automatically turn on autowiring

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

Sidebar

Related Questions

I have a pretty simple scenario using manual data operations with rad list view.
I have a pretty simple scenario and I'm sure I'm just missing something obvious.
I'm trying to do something pretty simple. Here's the scenario: I have a whole
Use scenario is pretty simple: I have a desktop only application that could be
I'm trying to something pretty simple but am having headaches with it. I'm pretty
I have a pretty simple scenario. I have the following HTML: <h1>Hello</h1> <input type="button"
Pretty simple scenario. I have a web service that receives a byte array that
I have the following seemingly simple scenario, however I'm still pretty new to NHibernate.
Ok - pretty basic scenario, been there before, seemed all so simple - but
I have pretty simple scenario (MVVM) DataTemplate visuals should change based on data I

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.