2, 왼쪽 패널에서 봄 선택 Initializr
프로젝트 이름, 프로젝트 그룹 이름, 프로젝트 ID를 입력하고 클릭하여 다음 단계로 진행하세요
다음 페이지는 종속성 추가 페이지이며 필요에 따라 종속성을 추가할 수 있습니다. 또는 pom.xml 파일에 추가할 수 있습니다. 주로 포함: Core(core dependency), SQL, NOSQL
현재 테스트에서는 Web만 확인하면 됩니다.2. 해당 디렉터리에 example.java를 생성합니다. 코드는 다음과 같습니다:
package com.example.demo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @EnableAutoConfiguration public class Example { @RequestMapping("/") String home() { return "Hello World!"; } @RequestMapping("/hello/{myName}") String index(@PathVariable String myName) { return "Hello "+myName+"!!!"; } }
3. 프로젝트를 실행하고 SpringbootTestApplication.java를 선택한 다음 마우스 오른쪽 버튼을 클릭하고 'SpringbootTestApplication'을 실행하거나 표시된 대로 버튼을 클릭합니다.
4. 프로그램이 성공적으로 시작됩니다. 콘솔은 다음과 같습니다(부분): 5. 마지막으로 테스트해 보겠습니다. http://localhost:8080/ 및 http://localhost:8080/hello를 입력합니다. /王达达🎜🎜테스트에 성공했습니다! ! ! 🎜🎜 마지막으로 참고용으로 pom.xml 코드도 첨부합니다. 🎜🎜
930406f08da8ee4a2ff134b688d29d1d 261ccf601aed9e706bad7e14d745ea63 f88eb0eb1aecac9ee9b4f14c6ec6df3b4.0.064e738e3986bec0362927b9ad33d6f1a 05a8acc5c31084a4f61ade01873802cacom.example192ca2f7b8c770b01c8f81e6bdd5b947 9bc4cbb67f66e148869423c0d27e5f90springboot_testb68fb17cb904a46b73e6272850323873 3d689bd3819ead35ed794427bd12f4590.0.1-SNAPSHOT83a577b3f930c490b31329be5e672d0b 0d5281799fde01379a2f5b5ea0c57ee5jarb381c39f05d1340a5f54760f38fa259d 8a11bc632ea32a57b3e3693c7987c420springboot_testdf406f776eecbaf16b62325323196f14 8b55addfb40ddf4a384b1010d729e503Demo project for Spring Boota11945cc7b2902590ebb81ca9fd0b283 58652436a08d62d32b90566dafe0913c 05a8acc5c31084a4f61ade01873802caorg.springframework.boot192ca2f7b8c770b01c8f81e6bdd5b947 9bc4cbb67f66e148869423c0d27e5f90spring-boot-starter-parentb68fb17cb904a46b73e6272850323873 3d689bd3819ead35ed794427bd12f4591.5.4.RELEASE83a577b3f930c490b31329be5e672d0b 9d08dd43193b87e544f7f9753dac4bce 8d2d71f76b067132be80f6f649e0b044 db7b8d074c72824ed121864240fe4c81 a01741acb88936e4cea4237317380dd9 1c7a7393b6227ec4d47c36077ff090b8UTF-8e1707586e242e616eb540a7accd7b351 d2d8c130ea6225f24b1c2ce2131af998UTF-837d0ee9d6f821be650562ff4d5ce07f8 cba97bffed69576781755455c6f1e4131.837fea447ce86e32369605f68ca6046c0 86cd8b5c0fbd401fb69261955cf13796 fce2022be5e87c17c94245fd7ccbf1d9 8a6cc4527fc0e71b0dfbcd757b4f1373 b4b38e33757a6497aa8690936b905cc1 05a8acc5c31084a4f61ade01873802caorg.springframework.boot192ca2f7b8c770b01c8f81e6bdd5b947 9bc4cbb67f66e148869423c0d27e5f90spring-boot-starter-webb68fb17cb904a46b73e6272850323873 09a0e22e5aaafd848ae04665be625b91 b4b38e33757a6497aa8690936b905cc1 05a8acc5c31084a4f61ade01873802caorg.springframework.boot192ca2f7b8c770b01c8f81e6bdd5b947 9bc4cbb67f66e148869423c0d27e5f90spring-boot-starter-testb68fb17cb904a46b73e6272850323873 06db57cb000bdd2564c5b32a302b10e2test03b1008234ba0cf6ad3c873aea327e8a 09a0e22e5aaafd848ae04665be625b91 d233ceef72c18d2307de4871b5eff5ad 5ac54a929980b32fdd2e48b6a8da067c c4222ff3007372f15ec728b963e717b6 33ca7039399a4759a8764ea38765dd46 05a8acc5c31084a4f61ade01873802caorg.springframework.boot192ca2f7b8c770b01c8f81e6bdd5b947 9bc4cbb67f66e148869423c0d27e5f90spring-boot-maven-pluginb68fb17cb904a46b73e6272850323873 9424ec9162a9b85f34067d0c54f34b32 f3567a435ac6132b26525998d793443b f82c24fb6fac67972f6e79c18ccef56a 1755c7176d4002e2a322de4f48c796fa🎜🎜 저는 SpringBoot 아키텍처를 처음 접했습니다. 나중에 잊지 않도록 먼저 적어 두세요🎜
위 내용은 SpringBoot 시작하기 1장: Hello World의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!