Maven 프로젝트를 자유롭게 빌드하십시오.
예 : 프로젝트 이름 t2
maven의 pom.xml 아래에 종속 jar를 작성하십시오.
<!-继承 父 包-> < parent > < groupId > org.springframework.boot </ groupId > < artifactId > spring-boot-starter-parent </ artifactId > < version > 1.3.3.RELEASE </ version > </ 부모 >
<!-spring-boot 的 web 启动 的 jar 包-> < dependencies > < dependency > < groupId > org.springframework.boot </ groupId > < artifactId > spring-boot-starter-web </ artifactId > </ dependency > <!-链接 数据库-> < dependency > < groupId > org.springframework.boot </ groupId > < artifactId > spring-boot-starter-data-jpa </ artifactId ></ dependency > <!-mybatis 注解-> < dependency > < groupId > org.mybatis.spring.boot </ groupId > < artifactId > mybatis-spring-boot-starter </ artifactId > < version > 1.1.1 </ 버전 > </ 종속성 > <!-mysql 驱动-> < 종속성 > < groupId > mysql </ groupId > < artifactId >mysql-connector-java </ artifactId > </ 종속성 > </ 종속성 >
다운로드가 완료 될 때까지 기다립니다.
springBoot의 주석 사용법에 대해 알아보기
1 、 @ EnableAutoConfiguration
프로그램 시작에 사용
예 :
@RestController @EnableAutoConfiguration public class App {
@RequestMapping ( "/ indexList" ) public List <String> indexList () { List <String> list = new LinkedList <String> (); list.add ( "1" ); list.add ( "2" ); list.add ( "3" ); 반환 목록; }
public static void main (String [] args) { SpringApplication. 실행 (App. class , args); }}
설정
application.properties
제어 바람둥이 인터페이스 삽입
server.port = 80
실행이 시작되면 통과 할 수 있습니다.
localhost / t2 / indexList
json 목록 컬렉션 반환
완전한