Skip to content

Commit

Permalink
Update microprofile examples to use microprofile-config.properties (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
barchetta authored Jul 14, 2020
1 parent 926a633 commit 1ec8339
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 27 deletions.
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.
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"

0 comments on commit 1ec8339

Please sign in to comment.