ng2 통합 spring boot 배경 (1)

ng2 와 Spring Boot 를 사용 하여 프로젝트 를 통합 합 니 다.
첫 번 째 로 Spring Boot 프로젝트 를 만 듭 니 다.
... 에 있다https://start.spring.io/REST 서 비 스 를 제공 하기 위해 배경 에 있 는 Spring Boot 프로그램 을 만 듭 니 다.
2 단계 분리 전 백 스테이지 모듈
앞 뒤 단 을 대응 하 는 서로 다른 maven 모듈 로 나 눕 니 다.
  • 전체 항목 디 렉 터 리 를 새로 만 들 고 백 엔 드 프로그램 을 복사 합 니 다.
  • 전체 디 렉 터 리 아래 전단 경 로 를 새로 만 듭 니 다. 예 를 들 어 frontend\src\main
  • 백 엔 드 의 pom 파일 을 복사 하여 전체 항목 디 렉 터 리 에 직접 놓 고 수정 합 니 다.
  • 
    
        4.0.0
    
        com.jdriven.ng2boot
        parent
        0.0.1-SNAPSHOT
        pom
    
        parent
        The ng2boot parent project
    
        
            org.springframework.boot
            spring-boot-starter-parent
            1.5.2.RELEASE
             
        
    
        
            UTF-8
            UTF-8
            1.8
        
    
        
            frontend
            backend
        
    
    
  • 백 엔 드 의 pom 파일 수정
  • 
    
        4.0.0
    
        backend
    
        backend
        The ng2boot backend project
    
        
            com.jdriven.ng2boot
            parent
            0.0.1-SNAPSHOT
        
    
        
            
                org.springframework.boot
                spring-boot-starter-web
            
    
            
                org.springframework.boot
                spring-boot-starter-test
                test
            
        
    
        
            
                
                    org.springframework.boot
                    spring-boot-maven-plugin
                
            
        
    
    
  • 프론트 데스크 에 pom 파일 추가
  • 
        4.0.0
    
        frontend
    
        frontend
        The ng2boot frontend project
    
        
            com.jdriven.ng2boot
            parent
            0.0.1-SNAPSHOT
        
    
        
            
            
        
    
    

    세 번 째 단계 ng2 프로그램 을 전단 에 추가 하 는 main 경로
    명령 실행: ng new --skip-git --directory frontend ng2boot프로젝트 경 로 를 실행 하 는 것 은 현재 경로 의 frontend 경로 에서 ng2boot 라 는 프로젝트 를 만 드 는 것 입 니 다. (이 이름 은 경로 에 나타 나 지 않 습 니 다)메모: git 디 렉 터 리 를 만 들 지 마 십시오. 전체적으로 Maven 프로젝트 이기 때문에 나중에 큰 프로젝트 에 따라 git 를 제출 할 것 입 니 다.
    STEP 4: maven 을 설정 하여 ng2 프로젝트 를 빌 드 합 니 다.
    frontend - maven - plugin 플러그 인 을 사용 하여 ng2 프로그램 을 컴 파일 합 니 다.
  • 전단 에 플러그 인 을 추가 한 pom 파일 의 build / plugins 부분 입 니 다.
  • 
                
                    com.github.eirslett
                    frontend-maven-plugin
                    1.3
    
                    
                        v6.10.1o
                        4.4.1
                        src/main/frontend
                    
    
                    
                        
                            install node and npm
                            
                                install-node-and-npm
                            
                        
    
                        
                            npm install
                            
                                npm
                            
                        
    
                        
                            npm run build
                            
                                npm
                            
    
                            
                                run build
                            
                        
                    
                
            
    

    좋은 웹페이지 즐겨찾기