I have a problem when im try to call a method from view.
My Java class with methods
public class FuncionesMuestroteca {
@Bean
public static boolean estoyMuestroteca() {
boolean resultado = false;
return resultado;
}
}
Now i call function from header.html
<th:block th:text="${FuncionesMuestroteca.estoyMuestroteca()}"/>
In POM.xml i have imported thymeleaf-extras version 2.1.0.RELEASE and thymeleaf 2.1.5
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
<version>2.1.0.RELEASE</version>
And here the StackTrace
org.springframework.expression.spel.SpelEvaluationException: EL1011E: Method call: Attempted to call method estoyMuestroteca() on null context object
If you need anything else, do not hesitate to tell me and I'll put it. Thank you in advance.
new StackTrace:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'estoyMuestroteca' available
HTML Edit
<div th:text="${@estoyMuestroteca.estoyMuestroteca()}"></div>
Method actual
@Configuration
public class FuncionesMuestroteca {
@Bean(name = "estoyMuestroteca")
public boolean estoyMuestroteca() {
boolean resultado = false;
return resultado;
}
}