question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make DefaultInstantiator extendable

See original GitHub issue

Currently, if you extend DefaultInstantiator and register your new custom instantiator through SPI, the custom Instantiator must be instantiated through a no-arg constructor. This constructor will not have access to a VaadinService instance and thus the private VaadinService service member variable in the parent DefaultInstantiator can never be set. This, in turn, means the init method will return false and the custom Instantiator won’t be picked up. If the init method is overridden to return true, the methods requiring the VaadinService instance will fail.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mvysnycommented, Apr 8, 2021

Note that in Vaadin 14.6, it will be possible to override an InstantiatorFactory, removing the need to have a custom VaadinServlet.

For Vaadin 14.5.x and lower, use something like the following:

@WebServlet(urlPatterns = "/*", asyncSupported = true)
public class MyServlet extends VaadinServlet {

    @Override
    protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException {
        VaadinServletService service = new VaadinServletService(this,
                deploymentConfiguration) {
            @Override
            protected Instantiator createInstantiator() throws ServiceException {
                return new MyInstantiator(this);
            }
        };
        service.init();
        return service;
    }

    public static class MyInstantiator extends DefaultInstantiator {
        public MyInstantiator(VaadinService service) {
            super(service);
        }
        // ... etc - override other methods as necessary.
    }
}
0reactions
mvysnycommented, Sep 15, 2021

Yeah I can see InstantiatorFactory but it’s not clear how to pass in a custom implementation to Vaadin! See https://github.com/vaadin/docs/issues/739

Read more comments on GitHub >

github_iconTop Results From Across the Web

All Classes (MicroStream API 7.0) - MicroStream Reference Manual
Default implementation that stores referenced instances only if required (i.e.. BinaryStorer.Eager. Identical to BinaryStorer.Default , but stores every ...
Read more >
Extendable Dining Table installation video - YouTube
We are going to show you how to install an extendable dining table in just a few minutes. You will see how easy...
Read more >
How to make an Extendable Dining Table - YouTube
Learn how to build this extendable dining table. This table is made of wood (oak) and steel. This is one of my best...
Read more >
Open Source Packages - KickJava.com
Change · ChangeAdapterFactory · ChangeAspectDataEvent · ChangeAttributeValue · ChangeCaseProposal · ChangeCollector · ChangeColorAction
Read more >
Vaadin framework Issues - Giters
VScrollTable pagelength is set to 0 when table has size lower than displaying 1 row completely breaking lazy loading ... Make DefaultInstantiator extendable....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found