Skip to content

Commit 41cbc7b

Browse files
Buzzardogregturn
authored andcommitted
Changes to work with Spring Initializr (#13)
* Changes to work with Spring Initializr Minor changes to make sense with Spring Initalizr. Also, some minor editing changes. * Changed spring-boot-application.adoc I edited spring-boot-application.adoc. I also needed to change `hello` to `com.example`, but that change needs to not impace all the guides right now. So I made a new version called spring-boot-application-new-path.adoc
1 parent 5034bdd commit 41cbc7b

4 files changed

+42
-16
lines changed
+12-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
:linkattrs:
22

3-
You can run the application from the command line with Gradle or Maven. Or you can build a single executable JAR file that contains all the necessary dependencies, classes, and resources, and run that. This makes it easy to ship, version, and deploy the service as an application throughout the development lifecycle, across different environments, and so forth.
3+
You can run the application from the command line with Gradle or Maven. You can also build a single executable JAR file that contains all the necessary dependencies, classes, and resources and run that. Building an executable jar so makes it easy to ship, version, and deploy the service as an application throughout the development lifecycle, across different environments, and so forth.
44

5-
If you are using Gradle, you can run the application using `./gradlew bootRun`. Or you can build the JAR file using `./gradlew build`. Then you can run the JAR file:
5+
If you use Gradle, you can run the application by using `./gradlew bootRun`. Alternatively, you can build the JAR file by using `./gradlew build` and then run the JAR file, as follows:
66

7+
====
78
[subs="attributes", role="has-copy-button"]
8-
....
9+
----
910
java -jar build/libs/{project_id}-0.1.0.jar
10-
....
11+
----
12+
====
1113

12-
If you are using Maven, you can run the application using `./mvnw spring-boot:run`. Or you can build the JAR file with `./mvnw clean package`. Then you can run the JAR file:
14+
If you use Maven, you can run the application by using `./mvnw spring-boot:run`. Alternatively, you can build the JAR file with `./mvnw clean package` and then run the JAR file, as follows:
1315

16+
====
1417
[subs="attributes", role="has-copy-button"]
15-
....
18+
----
1619
java -jar target/{project_id}-0.1.0.jar
17-
....
18-
19-
NOTE: The procedure above will create a runnable JAR. You can also opt to link:/guides/gs/convert-jar-to-war/[build a classic WAR file] instead.
20+
----
21+
====
2022

23+
NOTE: The steps described here create a runnable JAR. You can also link:/guides/gs/convert-jar-to-war/[build a classic WAR file].

how_to_complete_this_guide.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ifndef::complete[:complete: /complete]
33

44
How to complete this guide
55
--------------------------
6-
Like most Spring link:/guides[Getting Started guides], you can start from scratch and complete each step, or you can bypass basic setup steps that are already familiar to you. Either way, you end up with working code.
6+
Like most Spring link:/guides[Getting Started guides], you can start from scratch and complete each step or you can bypass basic setup steps that are already familiar to you. Either way, you end up with working code.
77

88
To **start from scratch**, move on to <<scratch>>.
99

@@ -14,4 +14,4 @@ To **skip the basics**, do the following:
1414
- cd into `{project_id}{initial}`
1515
- Jump ahead to <<initial>>.
1616

17-
**When you're finished**, you can check your results against the code in `{project_id}{complete}`.
17+
**When you finish**, you can check your results against the code in `{project_id}{complete}`.

spring-boot-application-new-path.adoc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
`@SpringBootApplication` is a convenience annotation that adds all of the following:
2+
3+
- `@Configuration`: Tags the class as a source of bean definitions for the application
4+
context.
5+
- `@EnableAutoConfiguration`: Tells Spring Boot to start adding beans based on classpath
6+
settings, other beans, and various property settings. For example, if `spring-webmvc` is
7+
on the classpath, this annotation flags the application as a web application and activates
8+
key behaviors, such as setting up a `DispatcherServlet`.
9+
- `@ComponentScan`: Tells Spring to look for other components, configurations, and
10+
services in the `com/example` package, letting it find the controllers.
11+
12+
The `main()` method uses Spring Boot's `SpringApplication.run()` method to launch an
13+
application. Did you notice that there was not a single line of XML? There is no `web.xml`
14+
file, either. This web application is 100% pure Java and you did not have to deal with
15+
configuring any plumbing or infrastructure.

spring-boot-application.adoc

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
`@SpringBootApplication` is a convenience annotation that adds all of the following:
2-
3-
- `@Configuration` tags the class as a source of bean definitions for the application context.
4-
- `@EnableAutoConfiguration` tells Spring Boot to start adding beans based on classpath settings, other beans, and various property settings. For example, if **spring-webmvc** is on the classpath this flags the application as a web application and activates key behaviors such as setting up a `DispatcherServlet`.
5-
- `@ComponentScan` tells Spring to look for other components, configurations, and services in the `hello` package, allowing it to find the controllers.
62

7-
The `main()` method uses Spring Boot's `SpringApplication.run()` method to launch an application. Did you notice that there wasn't a single line of XML? No **web.xml** file either. This web application is 100% pure Java and you didn't have to deal with configuring any plumbing or infrastructure.
3+
- `@Configuration`: Tags the class as a source of bean definitions for the application
4+
context.
5+
- `@EnableAutoConfiguration`: Tells Spring Boot to start adding beans based on classpath
6+
settings, other beans, and various property settings. For example, if `spring-webmvc` is
7+
on the classpath, this annotation flags the application as a web application and activates
8+
key behaviors, such as setting up a `DispatcherServlet`.
9+
- `@ComponentScan`: Tells Spring to look for other components, configurations, and
10+
services in the `hello` package, letting it find the controllers.
11+
12+
The `main()` method uses Spring Boot's `SpringApplication.run()` method to launch an
13+
application. Did you notice that there was not a single line of XML? There is no `web.xml`
14+
file, either. This web application is 100% pure Java and you did not have to deal with
15+
configuring any plumbing or infrastructure.

0 commit comments

Comments
 (0)