Controller class optoinal?

We had a consultant help us create our first Vaadin project earlier this year. We have since copied it and written our second one.

I’m trying now to figure out how to connect to two different database servers in a single project. Unfortunately, every tutorial I see, including the ones on this site, use objects that our Vaadin projects don’t have. For example, this tutotial, https://spring.io/guides/gs/accessing-data-mysql/, contains the creation of a Controller class. Our existing Vaadin project don’t have a Controller.

Can anyone explain to me how our projects can function with that? Are they optional? If so, how so?

Can anyone point me to a good source for how to point my Vaadin project to two different database servers?

Spring REST controllers are for exposing REST APIs. Vaadin Flow is a server-side framework that runs in the Spring container, so it can call your backend services directly with Java method calls without the need for REST controllers. So no need to worry about them, they don’t affect the database.

This seems to be a relevant tutorial on setting up access to two different databases in Spring https://www.baeldung.com/spring-data-jpa-multiple-databases

Thanks. That’s helpful.

I had actually tried that tutorial before, but again, what’s in it doesn’t completely match to what I see in our projects. I wasn’t sure how to mesh the two.

It’s hard to know, when things you try like this fail, whether you’ve just done something specific wrong or whether the whole approach is misguided and so will never work. I’m that much in the dark. I’m going to assume that since you recommended it, the technique represented in that tutorial can actually be applied to a Vaadin project. So, I’m going to give it another try. I think I have some ideas about what I might have done wrong.

Again, thanks.