This disclosure relates to a policy loading method, apparatus, electronic device, storage medium, and program product. The method includes: in response to a policy file change event, determining a changed policy file, the policy file including a policy logic description; converting the policy file into a
bytecode array conforming to a preset
syntax specification, the preset
syntax specification allowing the
bytecode array to be converted into a policy class object at runtime; converting the
bytecode array into a policy class object; in response to a policy execution instruction, determining a target policy class object from the policy class objects based on the policy execution instruction, creating a target policy instance based on the target policy class object, and executing the target policy instance. Specifically, when a new policy file is uploaded, it can be loaded in real-time at runtime, thus eliminating the dependency chain of encoding, compilation, packaging, release, and restart, shortening the loading cycle of the new policy file, improving the loading response speed of the new policy file, and meeting the needs of business scenarios with high real-time requirements.