|
15 | 15 | */
|
16 | 16 | package org.springframework.sbm;
|
17 | 17 |
|
18 |
| -import org.springframework.beans.factory.annotation.Autowired; |
| 18 | +import lombok.RequiredArgsConstructor; |
19 | 19 | import org.springframework.boot.ApplicationArguments;
|
20 | 20 | import org.springframework.boot.ApplicationRunner;
|
21 |
| -import org.springframework.boot.SpringApplication; |
22 |
| -import org.springframework.boot.autoconfigure.SpringBootApplication; |
23 | 21 | import org.springframework.context.annotation.Configuration;
|
24 |
| -import org.springframework.context.event.EventListener; |
25 |
| -import org.springframework.http.MediaType; |
26 |
| -import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportFileSystemRenderer; |
27 |
| -import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportRenderer; |
28 | 22 | import org.springframework.sbm.engine.commands.ApplyCommand;
|
29 | 23 | import org.springframework.sbm.engine.commands.ScanCommand;
|
30 | 24 | import org.springframework.sbm.engine.context.ProjectContext;
|
31 | 25 | import org.springframework.sbm.engine.context.ProjectContextHolder;
|
32 |
| -import org.springframework.sbm.engine.events.*; |
33 |
| -import org.springframework.stereotype.Controller; |
34 |
| -import org.springframework.web.bind.annotation.GetMapping; |
35 |
| -import org.springframework.web.bind.annotation.PostMapping; |
36 |
| -import org.springframework.web.bind.annotation.RequestParam; |
37 |
| -import org.springframework.web.bind.annotation.ResponseBody; |
38 |
| - |
39 |
| -import java.util.List; |
40 | 26 |
|
41 | 27 | @Configuration
|
42 |
| -public class SpringBootMigratorRunner implements ApplicationRunner { |
43 |
| - |
44 |
| - @Autowired |
45 |
| - private ScanCommand scanCommand; |
| 28 | +@RequiredArgsConstructor |
| 29 | +public class SpringBootMigratorRunner implements ApplicationRunner { |
46 | 30 |
|
47 |
| - @Autowired |
48 |
| - private ProjectContextHolder contextHolder; |
| 31 | + private final ScanCommand scanCommand; |
| 32 | + private final ProjectContextHolder contextHolder; |
| 33 | + private final ApplyCommand applyCommand; |
49 | 34 |
|
50 | 35 | @Override
|
51 | 36 | public void run(ApplicationArguments args) {
|
52 |
| - if(args.getSourceArgs().length == 0) { |
| 37 | + if (args.getSourceArgs().length == 0) { |
53 | 38 | System.err.println("PLease provide the path to the application as parameter.");
|
54 | 39 | return;
|
55 | 40 | }
|
56 | 41 | String applicationPath = args.getSourceArgs()[0];
|
57 | 42 | System.out.println("Scanning " + applicationPath);
|
58 | 43 | ProjectContext context = scanCommand.execute(applicationPath);
|
59 | 44 | contextHolder.setProjectContext(context);
|
| 45 | + applyCommand.execute(contextHolder.getProjectContext(), "boot-2.7-3.0-upgrade-report2"); |
60 | 46 | System.out.println("finished scan. Please open: http://localhost:8080/spring-boot-upgrade");
|
61 | 47 | }
|
62 | 48 |
|
|
0 commit comments