How to integrate Vaadin with Spring without spring Boot

public class MyUI extends UI {

private Hello hello;

protected void init(VaadinRequest vaadinRequest) {
    setContent(new Label(hello.sayHello()));      
@WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
public static class MyUIServlet extends VaadinServlet  {

[/code]I have tried examples of vaadin spring integration, but nothing works fine. I tried SpringBoot with vaadin its working. but I need only spring. I attached MyUI and Normal Class, Plaese Have a look.[code]
public class Hello {

public  String sayHello() {
    return "Hello from bean ";

[/code]I am getting
java.lang.NullPointerException. Am I missing anything?

MyUIServlet needs to extend SpringVaadinServlet instead of VaadinServlet. Let me know, if that helped.
The spring tutorial has a section for getting started without boot:

I changed to SpringVaadinServlet, now I am getting “No UIProvider has been added and there is no “UI” init parameter.” this error.

You need the applicationContext.xml and ContextLoaderListener too. Matti has a sample in his GitHub. I didn’t test, but I trust it works:

Thankyou! Its working fine.

Hayry, can u please send me the link of vaadinSpring CRUD example without boot.I searched for it but I found boot examples only.

I know there must be, but I didn’t find anything now. Which part of these crud tutorials is problematic for you to implement without boot?

Actually I am new to Spring vaadin integration. I tried this example
. It is in spring boot and working. I removed boot part and used Xml file and application context to get that Xml. Normally in boot we run the main class and then piont to the localhost. But what about in spring, what is the process? Do I need Xml Main class and which class should I run? Its little bit confusing.
When I run UI class error is “BeanFactory not initialized or already closed - call ‘refresh’ before accessing beans via the ApplicationContext”.
Here is my xml and main class where boot part is there. I replaced it with followin code.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
    xmlns:xsi="" xmlns:jdbc=""
    xmlns:tx="" xmlns:jpa=""

    <jpa:repositories base-package="com.hellorepo" />

    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
      <bean id="entityManagerFactory"
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan" value="com.hello" />
        <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="database" value="HSQL" />
                <property name="generateDdl" value="true" />                
    <jdbc:embedded-database id="dataSource" type="HSQL" />

    <context:annotation-config />
    <bean id="mainBean"
        class="com.hello.Application" />


public class Application {
    private CustomerRepository repository;
    public static void main(String[] args) throws IOException{
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicaton.xml");
             Application app = (Application) ctx.getBean("mainBean",Application.class);
        } finally {
    private void addCustomer() {
       Customer("Chloe", "O'Brian")); Customer("Kim", "Bauer")); Customer("David", "Palmer")); Customer("Michelle", "Dessler"));

Well classical Spring is usually built as a WAR and then deployed to some servlet container. Although, you can build spring-boot project as a WAR too. Out of curiosity, which part of the spring-boot makes it uncomfortable for you to be used?

I modified Matti’s sample to contain spring data and hibernate and stuff. It’s built as war. mvn package jetty:run to test it.

We are already working with vaadin and jpa container, due to some performance issues we tought to shift to vaadin spring without boot. If we use boot we may need to change a lot of code in existing project.
And I din’t find anything in this link

Okay I though you asked Spring data crud sample without Spring boot. Sorry if I understood incorrectly or my implementation wasn’t helpful.

Hey,Its ok. But I need Vaadin Spring Integration CRUD example. Plaese,Help me if you find any link for that.

In the project I linked I had copied the code from and implemented that without boot. Only thing it is missing is jar packaging and the main method loading test data into database. Is that main method the crucial part or what part you are missing from the crud integration?

Thank you so much Hayry. The project you posted is working well.

Johannes Häyry:
You need the applicationContext.xml and ContextLoaderListener too. Matti has a sample in his GitHub. I didn’t test, but I trust it works:

if we don’t need applicationContext.xml and ContextLoaderListener as I’ve java configuration then what should i do?