How to make ORM instances visibile in the / page of a Spring {Boot | Data JDBC} + Thymeleaf TE webapp

27 Views Asked by At

please excuse my poor English :)


I'm writing a Spring Boot + Spring Data JDBC webapp + Thymelaf TE + Lombok.

As usual I have model classes, repository classes and controller classes for every DB entity; all works as expected (more or less).

The webapp is DB driven, everything you'll see in web pages comes from DB: navigation, breadcrumb, contents, ecc.

So I use a @ControllerAdvice class in root package to make visibile in every template those structures needed for common functionalities.

The problem is, if I try to access List, "Model" being structures mapping ORM classes as Content, Category, etc. in every page, except for the root one (the one defined with

{
    registry.addViewController("/").setViewName("home");
} 

code by Spring Boot himself) where every instance of ORM structures is NULL. How to make ORM instances visibile also in the / page?

There's something I'm clearly missing or it's a FAQ, being notorious that one simply can't? At the moment I solved by putting / mapping (the home template) a splash page ("Welcome!") with no data and a redirect, but It's something very disappointing.

TIA.

I'm expecting to use same ORM also for the / template.

0

There are 0 best solutions below