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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:04:44+00:00 2026-05-28T08:04:44+00:00

i am developing a Webapplication with JSF2 and Spring3 and have a problem with

  • 0

i am developing a Webapplication with JSF2 and Spring3 and have a problem with deserialization.

I have some session-scoped beans defined like so:

@Controller(value = "admin")
@Scope(value = "session")
public class AdminBean implements Serializable {
...

also i have some singletons defined like so:

@Repository
public class Repo {

Singletons are injected into the session-beans like this

@Resource
private transient Repo repo;

After i added transient, my problems with serialization/deserialization went away. But now i have the problem that after deserialzing the dependencies (repo in this case) are null. I searched a lot on this problem and found some workarounds, but i still wonder what the best solution for this problem is?

It seems to me that using application-scoped beans in session-beans is a quite common case, isn’t there a clean solution for this? I came arround a solution with @Configurable, but do i really need some load-time-weaving stuff? The targets of the injection are already spring-managed, so it doesn’t make sense to me..
Please enlight me

update 2 years later: You CAN transparently inject session-scoped beans into application-scoped-beans (might not be a good idea in most cases though). I just had to set the proxyMode on @Scope accordingly.

  • 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-28T08:04:45+00:00Added an answer on May 28, 2026 at 8:04 am

    Try getting AutowireCapableBeanFactory through applicationContext.getAutowireCapableBeanFactory() and there are some methods like autowireBeanProperties, autowireBean and configureBean that should be able to reconfigure your ban after deserialization. Choose a method best for you (one of them triggers post processing, others not etc..)

    Second idea is to wrap Repo in a proxy, that is serializable. It’ll serialize with AdminBean and deserialize. This proxy should hold ‘real’ transient reference and if it gets null after deserialization, it should lookup it from the Application Context.

    I heard that Spring 3 automaticaly wraps beans with such a proxy, but I’ve never managed to make it work.

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

Sidebar

Related Questions

I'm developing an ASP.NET forms webapplication using C#. I have a method which creates
Im developing an webapplication using asp.NET C#. I am currently using this map controller.
I am developing an application in JSF 2.0 and I would like to have
Greetings, In the webapplication I am developing , I want to do something like
I am developing a webapplication based on JSP. I have a servlet class :
Im currently developing an webapplication that are going to have an Autocomplete search form,
I am developing a webapplication using asp.net mvc 3. In the solution I have
I'm developing a webapplication in the Vaadin framework. I have a table with 14
I am developing a web application which has Chart Controls. I have developed a
I am developing a web application using Struts 2.1.2 and Hibernate 3.2.6.GA. I have

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.