1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[JBoss] Spring Environment bean unable to supply properties value from standalone.xml of JBoss...

Discussão em 'StackOverflow' iniciado por Stack, Janeiro 14, 2025.

  1. Stack

    Stack Membro Participativo

    My Spring application is deployed in JBOSS wildfly server. I have an Interceptor like below - @Component public class AuthenticatorInterceptor implements HandlerInterceptor,Serializable {

    private static final long serialVersionUID = 1L;

    @Autowired
    private Environment environment;

    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
    throws ImplHubException,Exception {
    String myPropertyValue = environment.getProperty("myproperty");
    .......

    }


    myproperty is entered in standlaone.xml like -

    but the behaviour is - for some request myPropertyValue is picked while for other it is picked as null. I want to understand the reason. As AuthenticatorInterceptor is a Component and is singleton, and Environment is also Singleton. How every request is not getting fully loaded Environment bean? is it that singleton bean is per thread? I can try with System.getProperties("myproperty") directly in place of Environment bean, but what if the Component annotated interceptor does not get the bean. Though the issue is not happening in my local, it is happening in higher environments. So what configuration in jboss wildfly (16) may cause this issue and how we can try replicating the issue in local?

    Continue reading...

Compartilhe esta Página