cloudfoundry-samples/spring-sendgrid

Name: spring-sendgrid

Owner: Cloud Foundry Sample Applications

Description: A sample application for using Spring and SendGrid on Cloud Foundry.

Created: 2013-06-13 20:38:12.0

Updated: 2017-10-07 13:30:43.0

Pushed: 2016-04-22 22:43:08.0

Homepage: null

Size: 330

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

spring-sendgrid

A sample application for using Spring Framework and SendGrid on Cloud Foundry.

Running the application on Cloud Foundry

After installing in the 'cf' command-line interface for Cloud Foundry, targeting a Cloud Foundry instance, and logging in, the application can be pushed using these commands:

gradlew assemble
 push --path=build/libs/spring-sendgrid.war

If prompted to create a service for your app, select y and choose the SendGrid service. This will provision an account on SendGrid and bind it to your app, which stores credentials for the account in the VCAP_SERVICES environment variable. This application will read those credentials and use them when it sends e-mails.

The application will be pushed using settings in the provided manifest.yml file. The settings include some random characters in the host to make sure the URL for the app is unique in the Cloud Foundry environment. Once the app is uploaded and finishes staging, run the following command to see the URL that was assigned:

 app
g manifest file manifest.yml

ng-sendgrid: running
age: 512M × 1 instance
ls: spring-sendgrid-7acab.cfapps.io
rvices: sendgrid

Using the provided URL in the urls field displayed, you can browse to the running application.

You can see what environment variables are available to the application (including the VCAP_ENVIRONMENT variable) by navigating to http://<app-url>/env.

You can override the SendGrid credentials in the environment by configuring them in the file src/main/resources/application.properties.

Running the application locally

When running locally, the SendGrid credentials must be set manually in the file src/main/resources/application.properties.

After editing the file and adding the credentials, run this command to start the app:

adlew tomcatRun

Once the app is running you can browse to the URL http://localhost:8080/spring-sendgrid.

A note on `./gradlew'

The first time ./gradlew runs, it will take a while to download the build tool. Subsequent runs will be much faster.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.