Sync docs from master to gh-pages
This commit is contained in:
@@ -86,7 +86,26 @@ function createSwitchItem(block, blockSwitch) {
|
||||
return {'item': item, 'content': content};
|
||||
}
|
||||
|
||||
function globalSwitch() {
|
||||
$('.switch--item').each(function() {
|
||||
$(this).off('click');
|
||||
$(this).on('click', function() {
|
||||
selectedText = $(this).text()
|
||||
selectedIndex = $(this).index()
|
||||
$(".switch--item").filter(function() { return ($(this).text() === selectedText) }).each(function() {
|
||||
$(this).addClass('selected');
|
||||
$(this).siblings().removeClass('selected');
|
||||
selectedContent = $(this).parent().siblings(".content").eq(selectedIndex)
|
||||
selectedContent.removeClass('hidden');
|
||||
selectedContent.siblings().addClass('hidden');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(addBlockSwitches);
|
||||
$(globalSwitch);
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
@@ -133,6 +152,7 @@ $(addBlockSwitches);
|
||||
<ul class="sectlevel2">
|
||||
<li><a href="#_aws_lambda">AWS Lambda</a></li>
|
||||
<li><a href="#_microsoft_azure">Microsoft Azure</a></li>
|
||||
<li><a href="#_google_cloud_functions_alpha">Google Cloud Functions (Alpha)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -145,7 +165,7 @@ $(addBlockSwitches);
|
||||
<p>Mark Fisher, Dave Syer, Oleg Zhurakousky, Anshul Mehra</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p><strong>3.0.4.BUILD-SNAPSHOT</strong></p>
|
||||
<p><strong>3.1.0.BUILD-SNAPSHOT</strong></p>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -1912,18 +1932,178 @@ $ mvn azure-functions:deploy</pre>
|
||||
</td>
|
||||
<td class="content">
|
||||
The Azure sample app is written in the "non-functional" style (using <code>@Bean</code>). The functional style (with just <code>Function</code> or <code>ApplicationContextInitializer</code>) is much faster on startup in Azure than the traditional <code>@Bean</code> style, so if you don’t need <code>@Beans</code> (or <code>@EnableAutoConfiguration</code>) it’s a good choice. Warm starts are not affected.
|
||||
:branch: master
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_google_cloud_functions_alpha"><a class="link" href="#_google_cloud_functions_alpha">Google Cloud Functions (Alpha)</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The Google Cloud Functions adapter enables Spring Cloud Function apps to run on the <a href="https://cloud.google.com/functions">Google Cloud Functions</a> serverless platform.
|
||||
You can either run the function locally using the open source <a href="https://github.com/GoogleCloudPlatform/functions-framework-java">Google Functions Framework for Java</a> or on GCP.</p>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_getting_started_3"><a class="link" href="#_getting_started_3">Getting Started</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>Let’s start with a simple Spring Cloud Function example:</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">@SpringBootApplication
|
||||
public class CloudFunctionMain {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CloudFunctionMain.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return value -> value.toUpperCase();
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_test_locally"><a class="link" href="#_test_locally">Test locally</a></h5>
|
||||
<div class="paragraph">
|
||||
<p>Start by adding the Maven plugin provided as part of the Google Functions Framework for Java.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><plugin>
|
||||
<groupId>com.google.cloud.functions</groupId>
|
||||
<artifactId>function-maven-plugin</artifactId>
|
||||
<version>0.9.1</version>
|
||||
<configuration>
|
||||
<functionTarget>org.springframework.cloud.function.adapter.gcloud.FunctionInvoker</functionTarget>
|
||||
<port>8080</port>
|
||||
</configuration>
|
||||
</plugin></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Specify your configuration main class in <code>resources/META-INF/MANIFEST.MF</code>.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlightjs highlight"><code>Main-Class: com.example.CloudFunctionMain</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Then run the function:</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>mvn function:run</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Invoke the HTTP function:</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>curl http://localhost:8080/ -d "hello"</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_deploy_to_gcp"><a class="link" href="#_deploy_to_gcp">Deploy to GCP</a></h5>
|
||||
<div class="paragraph">
|
||||
<p>As of March 2020, Google Cloud Functions for Java is in Alpha.
|
||||
You can get on the <a href="https://docs.google.com/forms/d/e/1FAIpQLScC98jGi7CfG0n3UYlj7Xad8XScvZC8-BBOg7Pk3uSZx_2cdQ/viewform">whitelist</a> to try it out.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>First, add the Shade Plugin configuration to generate a fat jar when you run the <code>mvn package</code> command.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<outputDirectory>deploy</outputDirectory>
|
||||
<shadedClassifierName>gcp</shadedClassifierName>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
||||
<resource>META-INF/spring.handlers</resource>
|
||||
</transformer>
|
||||
<transformer implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer">
|
||||
<resource>META-INF/spring.factories</resource>
|
||||
</transformer>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
||||
<resource>META-INF/spring.schemas</resource>
|
||||
</transformer>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>com.example.CloudFunctionMain</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Package the application.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>mvn package</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>You should see the fat jar in <code>deploy</code> directory.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Make sure that you have the <a href="https://cloud.google.com/sdk/install">Cloud SDK CLI</a> installed.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>From the project base directory run the following command to deploy.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>gcloud alpha functions deploy function-sample-gcp \
|
||||
--entry-point org.springframework.cloud.function.adapter.gcloud.FunctionInvoker \
|
||||
--runtime java11 \
|
||||
--trigger-http \
|
||||
--source deploy \
|
||||
--memory 512MB</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Invoke the HTTP function:</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>curl https://REGION-PROJECT_ID.cloudfunctions.net/function-sample-gcp -d "hello"</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_sample_function"><a class="link" href="#_sample_function">Sample Function</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>Go to the <a href="../../spring-cloud-function-samples/function-sample-gcp/">function-sample-gcp</a> to try out a sample function that you can test locally or deploy to GCP.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="js/tocbot/tocbot.min.js"></script>
|
||||
<script type="text/javascript" src="js/toc.js"></script>
|
||||
<link rel="stylesheet" href="js/highlight/styles/atom-one-dark-reasonable.min.css">
|
||||
<link rel="stylesheet" href="js/highlight/styles/github.min.css">
|
||||
<script src="js/highlight/highlight.min.js"></script>
|
||||
<script>hljs.initHighlighting()</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user