Skip to content

Commit 4d9e347

Browse files
dashauncppwfs
authored andcommitted
Update getting started docs, reduce possible confusion, fix example, update output, with help from Harpreet Singh and Jonas Andersen
Remove doc for JDBC API because it is no longer needed
1 parent 18fd3d8 commit 4d9e347

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

docs/modules/ROOT/pages/getting-started.adoc

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ environment.
2020
[[getting-started-system-requirements]]
2121
== System Requirements
2222

23-
You need to have Java installed (Java 17 or better). To build, you need to have Maven
24-
installed as well.
23+
You need to have Java installed (Java 17 or better).
2524

2625
[[database-requirements]]
2726
=== Database Requirements
@@ -61,9 +60,8 @@ To do so:
6160

6261
. Visit the link:https://start.spring.io/[Spring Initialzr] site.
6362
.. Create a new Maven project with a *Group* name of `io.spring.demo` and an *Artifact* name of `helloworld`.
64-
.. In the Dependencies text box, type `task` and then select the `Cloud Task` dependency.
65-
.. In the Dependencies text box, type `jdbc` and then select the `JDBC` dependency.
66-
.. In the Dependencies text box, type `h2` and then select the `H2`. (or your favorite database)
63+
.. In the Dependencies text box, type `task` and then select the `Task` dependency with the `Spring Cloud` label.
64+
.. In the Dependencies text box, type `h2` and then select the `H2` dependency with the `SQL` label.
6765
.. Click the *Generate Project* button
6866
. Unzip the helloworld.zip file and import the project into your favorite IDE.
6967

@@ -73,7 +71,7 @@ To do so:
7371
To finish our application, we need to update the generated `HelloworldApplication` with the following contents so that it launches a Task.
7472
[source,java]
7573
----
76-
package io.spring.Helloworld;
74+
package io.spring.demo.helloworld;
7775
7876
import org.springframework.boot.ApplicationArguments;
7977
import org.springframework.boot.ApplicationRunner;
@@ -141,7 +139,7 @@ in that repository. In the xref:features.adoc#features-configuration[Configurati
141139
documentation), we cover how to customize the configuration of the pieces provided by
142140
Spring Cloud Task.
143141

144-
When our sample application runs, Spring Boot launches our `HelloWorldCommandLineRunner`
142+
When our sample application runs, Spring Boot launches our `HelloWorldApplicationRunner`
145143
and outputs our "`Hello, World!`" message to standard out. The `TaskLifecycleListener`
146144
records the start of the task and the end of the task in the repository.
147145

@@ -171,7 +169,7 @@ NOTE: Any processing bootstrapped from mechanisms other than a `CommandLineRunne
171169
=== Running the Example
172170

173171
At this point, our application should work. Since this application is Spring Boot-based,
174-
we can run it from the command line by using `$ mvn spring-boot:run` from the root
172+
we can run it from the command line by using `$ ./mvnw spring-boot:run` from the root
175173
of our application, as shown (with its output) in the following example:
176174

177175
[source]
@@ -187,32 +185,32 @@ $ mvn clean spring-boot:run
187185
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
188186
' |____| .__|_| |_|_| |_\__, | / / / /
189187
=========|_|==============|___/=/_/_/_/
190-
:: Spring Boot :: (v2.0.3.RELEASE)
191-
192-
2018-07-23 17:44:34.426 INFO 1978 --- [ main] i.s.d.helloworld.HelloworldApplication : Starting HelloworldApplication on Glenns-MBP-2.attlocal.net with PID 1978 (/Users/glennrenfro/project/helloworld/target/classes started by glennrenfro in /Users/glennrenfro/project/helloworld)
193-
2018-07-23 17:44:34.430 INFO 1978 --- [ main] i.s.d.helloworld.HelloworldApplication : No active profile set, falling back to default profiles: default
194-
2018-07-23 17:44:34.472 INFO 1978 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1d24f32d: startup date [Mon Jul 23 17:44:34 EDT 2018]; root of context hierarchy
195-
2018-07-23 17:44:35.280 INFO 1978 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
196-
2018-07-23 17:44:35.410 INFO 1978 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
197-
2018-07-23 17:44:35.419 DEBUG 1978 --- [ main] o.s.c.t.c.SimpleTaskConfiguration : Using org.springframework.cloud.task.configuration.DefaultTaskConfigurer TaskConfigurer
198-
2018-07-23 17:44:35.420 DEBUG 1978 --- [ main] o.s.c.t.c.DefaultTaskConfigurer : No EntityManager was found, using DataSourceTransactionManager
199-
2018-07-23 17:44:35.522 DEBUG 1978 --- [ main] o.s.c.t.r.s.TaskRepositoryInitializer : Initializing task schema for h2 database
200-
2018-07-23 17:44:35.525 INFO 1978 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from class path resource [org/springframework/cloud/task/schema-h2.sql]
201-
2018-07-23 17:44:35.558 INFO 1978 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executed SQL script from class path resource [org/springframework/cloud/task/schema-h2.sql] in 33 ms.
202-
2018-07-23 17:44:35.728 INFO 1978 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
203-
2018-07-23 17:44:35.730 INFO 1978 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure
204-
2018-07-23 17:44:35.733 INFO 1978 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
205-
2018-07-23 17:44:35.738 INFO 1978 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
206-
2018-07-23 17:44:35.762 DEBUG 1978 --- [ main] o.s.c.t.r.support.SimpleTaskRepository : Creating: TaskExecution{executionId=0, parentExecutionId=null, exitCode=null, taskName='application', startTime=Mon Jul 23 17:44:35 EDT 2018, endTime=null, exitMessage='null', externalExecutionId='null', errorMessage='null', arguments=[]}
207-
2018-07-23 17:44:35.772 INFO 1978 --- [ main] i.s.d.helloworld.HelloworldApplication : Started HelloworldApplication in 1.625 seconds (JVM running for 4.764)
188+
:: Spring Boot :: (v3.2.1)
189+
190+
2024-01-04T10:07:01.102-06:00 INFO 18248 --- [helloWorld] [ main] i.s.d.helloworld.HelloworldApplication : Starting HelloworldApplication using Java 21.0.1 with PID 18248 (/Users/dashaun/fun/dashaun/spring-cloud-task/helloworld/target/classes started by dashaun in /Users/dashaun/fun/dashaun/spring-cloud-task/helloworld)
191+
2024-01-04T10:07:01.103-06:00 INFO 18248 --- [helloWorld] [ main] i.s.d.helloworld.HelloworldApplication : No active profile set, falling back to 1 default profile: "default"
192+
2024-01-04T10:07:01.526-06:00 INFO 18248 --- [helloWorld] [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
193+
2024-01-04T10:07:01.626-06:00 INFO 18248 --- [helloWorld] [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection conn0: url=jdbc:h2:mem:3ad913f8-59ce-4785-bf8e-d6335dff6856 user=SA
194+
2024-01-04T10:07:01.627-06:00 INFO 18248 --- [helloWorld] [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
195+
2024-01-04T10:07:01.633-06:00 DEBUG 18248 --- [helloWorld] [ main] o.s.c.t.c.SimpleTaskAutoConfiguration : Using org.springframework.cloud.task.configuration.DefaultTaskConfigurer TaskConfigurer
196+
2024-01-04T10:07:01.633-06:00 DEBUG 18248 --- [helloWorld] [ main] o.s.c.t.c.DefaultTaskConfigurer : No EntityManager was found, using DataSourceTransactionManager
197+
2024-01-04T10:07:01.639-06:00 DEBUG 18248 --- [helloWorld] [ main] o.s.c.t.r.s.TaskRepositoryInitializer : Initializing task schema for h2 database
198+
2024-01-04T10:07:01.772-06:00 DEBUG 18248 --- [helloWorld] [ main] o.s.c.t.r.support.SimpleTaskRepository : Creating: TaskExecution{executionId=0, parentExecutionId=null, exitCode=null, taskName='helloWorld', startTime=2024-01-04T10:07:01.757268, endTime=null, exitMessage='null', externalExecutionId='null', errorMessage='null', arguments=[]}
199+
2024-01-04T10:07:01.785-06:00 INFO 18248 --- [helloWorld] [ main] i.s.d.helloworld.HelloworldApplication : Started HelloworldApplication in 0.853 seconds (process running for 1.029)
208200
Hello, World!
209-
2018-07-23 17:44:35.782 DEBUG 1978 --- [ main] o.s.c.t.r.support.SimpleTaskRepository : Updating: TaskExecution with executionId=1 with the following {exitCode=0, endTime=Mon Jul 23 17:44:35 EDT 2018, exitMessage='null', errorMessage='null'}
201+
2024-01-04T10:07:01.794-06:00 DEBUG 18248 --- [helloWorld] [ main] o.s.c.t.r.support.SimpleTaskRepository : Updating: TaskExecution with executionId=1 with the following {exitCode=0, endTime=2024-01-04T10:07:01.787112, exitMessage='null', errorMessage='null'}
202+
2024-01-04T10:07:01.799-06:00 INFO 18248 --- [helloWorld] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
203+
2024-01-04T10:07:01.806-06:00 INFO 18248 --- [helloWorld] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
204+
205+
....... . . .
206+
....... . . . (Maven log output here)
207+
....... . . .
210208
----
211209

212-
The preceding output has three lines that of interest to us here:
210+
The preceding output has three lines that are of interest to us here:
213211

214212
* `SimpleTaskRepository` logged the creation of the entry in the `TaskRepository`.
215-
* The execution of our `CommandLineRunner`, demonstrated by the "`Hello, World!`" output.
213+
* The execution of our `ApplicationRunner`, demonstrated by the "`Hello, World!`" output.
216214
* `SimpleTaskRepository` logs the completion of the task in the `TaskRepository`.
217215

218216
NOTE: A simple task application can be found in the samples module of the Spring Cloud

0 commit comments

Comments
 (0)