Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update microprofile examples to use microprofile-config.properties #2163

Merged
merged 3 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/microprofile/hello-world-explicit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ Then try the endpoints:

```
curl -X GET http://localhost:7001/helloworld
curl -X GET http://localhost:7001/helloworld/another
curl -X GET http://localhost:7001/helloworld/earth
```

By default the server will use a dynamic port, see the messages displayed
when the application starts.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't looked deeply but down below you set the port to 7001, so will a dynamic port truly be used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the explicit example it uses a dynamic port. In the implicit example it uses 7001.

Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import io.helidon.microprofile.server.Server;

import org.eclipse.microprofile.config.spi.ConfigProviderResolver;

/**
* Explicit example.
*/
Expand All @@ -28,16 +26,12 @@ private Main() {
}

/**
* Starts server and initializes CDI container manually.
* Starts server manually.
*
* @param args command line arguments (ignored)
*/
public static void main(String[] args) {
Server server = Server.builder()
// Provide a MicroProfile config instance (in this case the default...)
.config(ConfigProviderResolver.instance()
.getBuilder()
.build())
.host("localhost")
// use a random free port
.port(0)
Expand All @@ -50,7 +44,5 @@ public static void main(String[] args) {
System.out.println("Metrics available on " + endpoint + "/metrics");
System.out.println("Heatlh checks available on " + endpoint + "/health");

// the easiest possible explicit way to start an application:
// Server.create(HelloWorldApplication.class).start();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,11 +14,7 @@
# limitations under the License.
#

app:
name: "Hello World Application"
someInt: 147
uri: "http://www.google.com"
ints: [12, 12, 32, 12, 44]

server.port: 7001
app.name=Hello World Application
app.uri=https://www.example.com

my.property=propertyValue
3 changes: 2 additions & 1 deletion examples/microprofile/hello-world-implicit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ Then try the endpoints:

```
curl -X GET http://localhost:7001/helloworld
curl -X GET http://localhost:7001/helloworld/another
curl -X GET http://localhost:7001/helloworld/earth
curl -X GET http://localhost:7001/another
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018,2020 Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,10 +14,11 @@
# limitations under the License.
#

app:
name: "Hello World Application"
someInt: 147
uri: "http://www.google.com"
ints: [12, 12, 32, 12, 44]
app.name=Hello World Application
app.someInt=147
app.uri=https://www.example.com
app.someInt=147
app.ints=12,12,32,12,44

server.port=7001

my.property: "propertyValue"