Time Zone Support

When trying to implement a custom time zone support as provided in this Time Zone Support guidance, I’m experiencing some challenges trying to make my CustomZoneRulesProvider class the default provider. I created the constants.list file as suggested to point to the new custom class and placed it in a resource directory within the app module, but it seems this is not working as expected since it is still referencing the DefaultZoneRulesProvider. Any additional guidance you could provide to help me figure out what I’m missing is appreciated.

Hi Eric,

I have just tested from a new project:

  • add the custom implementation class from snippet
  • set the provider in myapp.constants.list resource file
  • call java.time API from my application (tested with ZoneRulesProvider.getAvailableZoneIds())

and it works as expected (I get "CustomZone").

Can you make sure you don’t name the resource file just constants.list but something.constants.list ?
This is needed for the file to be recognized by our build tools and also recommended as you could override your dependencies constants.list in the classpath.

If this is not the issue, can you describe more precisely what you are trying to do ?
What API are you using ?

Best regards,