You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Adding multipane
* Added linenums
* Changing format of test explanation, fixing typo
* Fix line numbers
* Adding code_commands
* Removing backticks, fixing hotspots
* Adding hotspots to code_commands
* Removed extra highlight lines
* testing action to create files
* Removing highlight
* Minor fixess in spacing for multipane
* Added inline hotspots and reverted previous code_commands
* Updated multipane
* Updated multipane
* Updated multipane
* Updated multipane
* updated README
* updated README
* updated README
* updated README
* updated README
* updated the POM files
* updated POM file and README
* updated README
* updated README
* updated README
* updated README
* update README
* updated README
* updated travis.yml
* Move the code files to after where the hotspots refer to the file. For hotspots after the last code file, added a index of which file it is for
* Fix hotspot ranges for the Handling dependencies in the application section
* Fix add() hotspot
* updated README
* updated README
* updated README
* updated README
* updated README
* updated README
* updated README and POM files
* Moved includes to bottom of subsection
* Moved includes to bottom of subsection
* Revert
* Updated hotspot
* Reverted back to Rachel's original commit
* updated README
* updated files for multipane
* updated README
* Removed finish.adoc include from README.adoc
* Updating dependency order
* JDK 11 pom update
* JDK update
* Updated README with [hotspot] changes
* Updated README with link in new tab changes
* Updated README with link in new tab changes
* Updated README
* Updated README
* Updated README
* Updated README.adoc
* Adding hotspot and fixing copyright being displayed on right pane
* Fixing typo in file number
* Minor readme updates
* Change the guide attribution to point to master
* Removing duplicate dependencies, updating copyrights
* Updating copyright
NOTE: This repository contains the guide documentation source. To view the guide in published form, view it on the https://openliberty.io/guides/{projectid}.html[Open Liberty website].
26
27
27
-
Learn how to use Contexts and Dependency Injection to manage and inject dependencies into microservices.
28
+
Learn how to use Contexts and Dependency Injection to manage scopes and inject dependencies into microservices.
28
29
29
30
== What you'll learn
30
31
31
-
You will learn how to use Contexts and Dependency Injection (CDI) in a simple inventory management application
32
-
to manage scopes and inject dependencies.
32
+
You will learn how to use Contexts and Dependency Injection (CDI) to manage scopes and inject dependencies in a simple inventory management application.
33
33
34
34
The application that you will be working with is an `inventory` service,
35
35
which stores the information about various JVMs that run on different systems.
@@ -44,9 +44,10 @@ You will also use dependency injection to inject one bean into another to make u
44
44
This enables you to inject the bean in its specified context without having to instantiate it yourself.
45
45
46
46
The implementation of the application and its services are provided for you in the `start/src` directory.
47
-
The `system` service can be found in `start/src/main/java/io/openliberty/guides/system`, and the `inventory` service can be found
48
-
in `start/src/main/java/io/openliberty/guides/inventory`. If you want to learn more about RESTful web services and how to build them, see
49
-
https://openliberty.io/guides/rest-intro.html[Creating a RESTful web service] for details about how to build the `system` service.
47
+
The `system` service can be found in the `start/src/main/java/io/openliberty/guides/system` directory,
48
+
and the `inventory` service can be found in the `start/src/main/java/io/openliberty/guides/inventory` directory.
49
+
If you want to learn more about RESTful web services and how to build them, see
50
+
https://openliberty.io/guides/rest-intro.html[Creating a RESTful web service^] for details about how to build the `system` service.
50
51
The `inventory` service is built in a similar way.
51
52
52
53
=== What is CDI?
@@ -62,6 +63,7 @@ controlling exactly when and how these components are instantiated and destroyed
@@ -71,28 +73,28 @@ The `finish` directory in the root of this guide contains the finished inventory
71
73
To try out the application, first navigate to the `finish` directory and then run the following
72
74
Maven goals to build the application and run it inside Open Liberty:
73
75
76
+
[role='command']
74
77
```
75
78
cd finish
76
79
mvn install liberty:start-server
77
80
```
78
81
79
-
Point your browser to the http://localhost:9080/inventory/systems URL. This is the starting point of the `inventory`
82
+
Point your browser to the http://localhost:9080/inventory/systems[http://localhost:9080/inventory/systems^] URL. This is the starting point of the `inventory`
80
83
service and it displays the current contents of the inventory. As you might expect, these are empty since
81
-
nothing is stored in the inventory yet. Next, point your browser to the http://localhost:9080/inventory/systems/localhost URL.
84
+
nothing is stored in the inventory yet. Next, point your browser to the http://localhost:9080/inventory/systems/localhost[http://localhost:9080/inventory/systems/localhost^] URL.
82
85
You see a result in JSON format with the system properties of your local JVM. When you visit this URL, these system
83
-
properties are automatically stored in the inventory. Go back to http://localhost:9080/inventory/systems and
86
+
properties are automatically stored in the inventory. Go back to http://localhost:9080/inventory/systems[http://localhost:9080/inventory/systems^] and
84
87
you see a new entry for `localhost`. For simplicity, only the OS name and username are shown here for
85
88
each host. You can repeat this process for your own hostname or any other machine that is running
86
89
the `system` service.
87
90
88
91
After you are done checking out the application, stop the Open Liberty server:
89
92
93
+
[role='command']
90
94
```
91
95
mvn liberty:stop-server
92
96
```
93
97
94
-
95
-
96
98
== Handling dependencies in the application
97
99
98
100
You will use CDI to inject dependencies into the inventory manager application and learn how to manage the life cycles of your objects.
@@ -101,69 +103,90 @@ You will use CDI to inject dependencies into the inventory manager application a
101
103
102
104
Navigate to the `start` directory to begin.
103
105
104
-
Create the inventory manager class in the `src/main/java/io/openliberty/guides/inventory/InventoryManager.java` file:
0 commit comments