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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:12:51+00:00 2026-05-23T08:12:51+00:00

I have a Wicket Page with a @SpringBean class ScreenDetailsPage(parameters: PageParameters) extends BasePage(parameters) {

  • 0

I have a Wicket Page with a @SpringBean

class ScreenDetailsPage(parameters: PageParameters) extends BasePage(parameters) {
    @SpringBean(name = "screenDAO") protected var screenDao: DAO[Screen] = null
    assertNotNull(screenDao)

and I find that the @SpringBean is not populated. It makes no difference if screenDao is val or var, protected or private.

Looking up the tree I find that the constructor of Component (indirectly) initialises @SpringBeans on behalf of its subclasses, but then the assignment to null is uninitializing it. But the assignment is required by Scala.

How can I prevent this behaviour?

  • 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-23T08:12:52+00:00Added an answer on May 23, 2026 at 8:12 am

    Try

    class ScreenDetailsPage(parameters: PageParameters) extends BasePage(parameters) {
        @SpringBean(name = "screenDAO") protected var screenDao: DAO[Screen] = _
        assertNotNull(screenDao)
    

    I have not tried this, but am also thinking about starting a Wicket/Scala project, and saw this blog entry, which might be useful in other ways as well.

    The relevant section quoted from that blog is

    In addition, note that the field is assigned to an underscore (_), which tells the Scala compile to NOT initialize, but leave it at the default state (null in this case). This is required for the injection to work. If you assign it to null explicitly, you
    will overwrite the Spring bean as the injection will occur before the constructor of MyPage is executed.

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

Sidebar

Related Questions

I have a Wicket page class that sets the page title depending on the
I have a Wicket Web Page where I create a new Object of class
In the Wicket Application class I have mounted a page at the location /about
I have a wicket page , which contains two Spring-managed beans , one is
We have a Wicket app with a page that includes an embedded Youtube video.
I'm developing an e-commerce using Wicket to render pages. I have a BasePage with
I have a BasePage.java (together with a BasePage.html ). My base page is basically
Situation In my Wicket application, I have a page which contains two tags. Each
I have an existing DataTable built in Wicket 1.5 as follows: The Page's java
On a Wicket page, I produce links with images via the following: @Override protected

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.