Developing Solutions Locally

At this point it is assumed, that the initial setup and the mandatory commands of the Solution CLI have been performed and executed as described. Follow the steps below if you want to test a Java solution locally:

  1. Create an application-local.yaml file and override properties needed for the local profile.
  2. To access local mongoDB, you can set the spring.data.mongodb.uri property to change the URL and configure additional settings such as the replica set, as shown in the following example:
    
    spring:
      data:
        mongodb:
        uri=mongodb://<username>:<secret>@<host>:<port>/<database>
            
    Alternatively, you can specify connection details using discrete properties. For example, you might declare the following settings as shown below:
    
    spring:
      data:
        mongodb:
        host: <host>
        port: <port>
        database: <database>
        username: <username>
        password: <password>
            
  3. To configure Swagger UI for local development, use the settings below:
    
    springdoc:
      api-docs:
        enabled: true
        path: /<solutionAcronym>/api-docs
      swagger-ui:
        oauth:
        clientId: <client-id>
            
  4. If you have spring-security-oauth2-client on your classpath, you can take advantage of some auto-configuration to set up an OAuth2/Open ID Connect client, as shown in the following example:
    
    spring:
      security:
        oauth2:
          client:
            registration:
              my-client-1:
              client-id: <client-id>
              client-secret: <secret>
              client-name: <client-for-user-scope>
              provider: <provider-name>
              scope: <scope>
              redirect-uri: <redirect-url>
              client-authentication-method: <authentication-type>
              authorization-grant-type: <grant-type>
            provider:
              oidc-provider:
              issuer-uri: <issuer-url>
            
  5. Build and run the code. Pass the configuraton below in jvm arguments to use the local profile.
    
              -Dspring.profiles.active=local
            
Note: Refer to Sprint Boot's official documentation for more details on configuration.