Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Feb 7, 2019
1 parent 45e14c1 commit 55c3c43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include::protean-intro.adoc[tag=intro]
* link:websocket-guide.html[Using Websockets]
* link:hibernate-orm-guide.html[Using Hibernate ORM]
* link:opentracing-guide.html[Using OpenTracing]
* link:spring-di-guide.html[Using Spring Dependency Injection Annotations]
* link:spring-di-guide.html[Using our Spring Dependency Injection annotations compatibility layer]
* link:extension-authors-guide.html[Write Your Own Extension] _(advanced)_
* link:performance-measure.html[Measuring Performance] _(advanced)_
* link:cdi-reference.html[Contexts and Dependency Injection] _(advanced)_
Expand Down
24 changes: 12 additions & 12 deletions docs/src/main/asciidoc/spring-di-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= {project-name} - Using Spring Dependency Injection annotations
= {project-name} - Using our Spring Dependency Injection annotations compatibility layer

This guide explains how your {project-name} application can utilize the well known Dependency Injection related annotation that the Spring Framework provides.
While you are encouraged to use CDI annotations for injection, {project-name} provides a compatibility layer for Spring dependency injection in the form of the `spring-di` extension.

== Prerequisites

Expand Down Expand Up @@ -59,9 +59,9 @@ where `spring.version` can be any version higher than `3.2.0.RELEASE`.

== Add beans using Spring annotations

Let's proceed to create some beans using various Spring annotations
Let's proceed to create some beans using various Spring annotations.

First we will create a `StringFunction` interface that some of our beans will implement and that will be injected into `TracedResource` later on.
First we will create a `StringFunction` interface that some of our beans will implement and that will be injected into another bean later on.
Create a `src/main/java/org/acme/spring/di/StringFunction.java` file and set the following content:

[source,java]
Expand All @@ -75,8 +75,8 @@ public interface StringFunction extends Function<String, String> {
}
----

With the interface in place, we will add an `AppConfiguration` class which will use the Spring's Java Config style of defining a bean.
Create a `src/main/java/org/acme/spring/di/AppConfiguration.java` file and set the following content:
With the interface in place, we will add an `AppConfiguration` class which will use the Spring's Java Config style of defining a bean. It will be used to create a `StringFunction` bean that will capitalize the text passed as parameter.
Create a `src/main/java/org/acme/spring/di/AppConfiguration.java` file with the following content:

[source,java]
----
Expand All @@ -88,14 +88,14 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class AppConfiguration {
@Bean(name = "cap")
@Bean(name = "capitalizeFunction")
public StringFunction capitalizer() {
return String::toUpperCase;
}
}
----

Now we define another bean that will implement `StringFunction` using Spring's stereotype annotation style.
Now we define another bean that will implement `StringFunction` using Spring's stereotype annotation style. This bean will effectively be a no-op bean that simply returns the input it is passed.
Create a `src/main/java/org/acme/spring/di/NoOpSingleStringFunction.java` file and set the following content:

[source,java]
Expand All @@ -104,7 +104,7 @@ package org.acme.spring.di;
import org.springframework.stereotype.Component;
@Component("noop")
@Component("noopFunction")
public class NoOpSingleStringFunction implements StringFunction {
@Override
Expand Down Expand Up @@ -163,11 +163,11 @@ public class GreeterBean {
private final MessageProducer messageProducer;
@Autowired
@Qualifier("noop")
@Qualifier("noopFunction")
private StringFunction noopStringFunction;
@Autowired
@Qualifier("cap")
@Qualifier("capitalizeFunction")
private StringFunction capitalizerStringFunction;
@Value("${greeting.suffix:!}")
Expand Down Expand Up @@ -219,7 +219,7 @@ public class GreeterResource {

== Update the test

We also need to update the functional test to reflect the changes made to endpoint.
We also need to update the functional test to reflect the changes made to the endpoint.
Edit the `src/test/java/org/acme/spring/di/GreetingResourceTest.java` file and change the content of the `testHelloEndpoint` method to:


Expand Down

0 comments on commit 55c3c43

Please sign in to comment.