How does Broadleaf identify that a new route/endpoint is added to the code (not default broadleaf one)?

For example if I want to add a new endpoint to notification service, how do I make sure it is registered and working? And if I want to address this route from another service for access_token fetching, how do I achieve that?

To register the new endpoint you need to add the base package with your endpoint to the Spring configuration. For example @ComponentScan(basePackageClasses = ExtendedNotificationEndpoint.class). This is not related to the Data Routing.

To execute the request to any API endpoint you need to use an Authorized client. In your example, you want to send the request to the Notification service, so you need to use a client of the service from which you are calling the notification service which has appropriate permission and scope for accessing notification service. For example, if your request has to be executed from the Cart Operation service, then the “cartopsclient” is more suitable to do so. In other words, the Cart Operation service is a client for Notification service.

You can read more about Authorized clients from the Spring documentation
https://docs.spring.io/spring-authorization-server/reference/core-model-components.html#registered-client
https://docs.spring.io/spring-security/reference/servlet/oauth2/login/core.html#oauth2login-custom-provider-properties. You can also refer Broadleaf Dev Central for obtaining client credentials.