Open jcgueriaud1 opened 2 years ago
The described scenario is the same as our's.
There is a simple workaround adding this snippet to your spring configuration:
@Bean
public AppShellPredicate appShellPredicate() {
return clz -> AppShellConfigurator.class.isAssignableFrom(clz) &&
!(Modifier.isAbstract(clz.getModifiers()) || clz.isInterface());
}
@SonReimer thanks for your suggested workaround. I am trying to figure out what you mean by "your spring configuration". Would you please advise what Spring file should you snippet go to? Thanks in advance.
This may be your application class, which is a configuration class too, or any other Spring configuration class , that is referenced from your application by @Import. Perhaps you could create one and put it to your common module ?
Thanks for your prompt response. From where will appShellPredicate() be called to avoid the error described by @jcgueriaud1? I have placed the function in the common module but it's not being called.
Here's an example:
package de.bmiag.gear.frontend.spring.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.vaadin.flow.component.page.AppShellConfigurator;
import com.vaadin.flow.server.startup.AppShellPredicate;
/**
* spring frontend configuration
*/
@Configuration
public class FrontendMetaConfiguration {
@Bean
public AppShellPredicate appShellPredicate() {
return clz -> AppShellConfigurator.class.isAssignableFrom(clz) &&
!(Modifier.isAbstract(clz.getModifiers()) || clz.isInterface());
}
}
Thanks for your example. For some reason, it didnt' work for me. However, I found a better way to manipulate page settings towards SEO-friendly content, which is using static HTML rather than dynamic Vaadin pages.
The issue was triaged and currently added to the backlog priority queue for further investigation
Describe your motivation
I want to be able to package common configuration in a jar that I can reuse it in different applications.
Describe the solution you'd like
I would like to create one common abstract class in a module:
Then in the application:
But I have this error:
I'm not sure if it's a bug or an enhancement.
In this pull request the own interface
AppShellConfigurator
is ignored: https://github.com/vaadin/flow/pull/13663/files but I think it would be more relevant to exclude all the interfaces and the abstract classes. That would fix the issue.