I want to override the setTargetPath
from the default ExceptionListener (documentation). But I need additional service to handle this.
In my opinion there is only the way to override the service definition, copy it to my service definitions and create an own constructor, but I don't like this approach.
Is there any other way to do this?
As for answer, if you are using form_login type, you can set it to a constant route where the redirect after login should happen. Config
You should set these 2 keys:
always_use_default_target_path: true
default_target_path: /route_name_for_redirect
Or option B, you use a success handler service, where you simply returns a RedirectResponse