I am trying to get Spring active profile in JPA Entity Listener using System.getproperty("spring.profiles.active"). But it is always returning Null profile. However I have checked on server and profile is correctly configured.
I have tried to get Spring active profile using Environment but in the listener, I am unable to @Autowired Environment also. 
    @PostUpdate
    public void methodInvoked afterUpdate(Example example){
    String activeProfile = System.getproperty("spring.profiles.active");  
    }
Any guidance please !
 
     
     
     
     
     
    