[F-lab 챌린지 73일차 TIL]

성수데브리·2023년 9월 8일
0

f-lab_java

목록 보기
61/73

JAR Files ?

  • Java Archive file format 으로 스프링 부트를 구성하는 파일들을 하나의 파일로 패키징 한 것
  • JAR 파일에는 class 파일과 어플리케이션 실행을 위한 관련 파일들이 담기게 된다.

JAR 파일 장점

  1. 보안 : JAR 파일 내용에 서명해서 권한 체크를 할 수 있음
  2. 다운로드 시간 감축 : 하나의 HTTP 트랜잭션으로 JAR 파일 다운로드 가능함
  3. 압축
  4. Packaging for extensions : JAR 파일은 애플리케이션에 기능 추가 가능함
  5. 패키지 sealing : 이해못함 → 문서 링크
  6. 패키지 버전 : A JAR file can hold data about the files it contains, such as vendor and version information.
  7. 이식성 : The mechanism for handling JAR files is a standard part of the Java platform's core API.

JAR 파일 내용 보기

jar tf heeverse-ticket-0.0.1-SNAPSHOT.jar
  • jar content 내용 보기
    
                                        
    META-INF/
    META-INF/MANIFEST.MF
    org/
    org/springframework/
    org/springframework/boot/
    org/springframework/boot/loader/
    org/springframework/boot/loader/ClassPathIndexFile.class
    org/springframework/boot/loader/ExecutableArchiveLauncher.class
    org/springframework/boot/loader/JarLauncher.class
    org/springframework/boot/loader/LaunchedURLClassLoader$DefinePackageCallType.class
    org/springframework/boot/loader/LaunchedURLClassLoader$UseFastConnectionExceptionsEnumeration.class
    org/springframework/boot/loader/LaunchedURLClassLoader.class
    org/springframework/boot/loader/Launcher.class
    org/springframework/boot/loader/MainMethodRunner.class
    org/springframework/boot/loader/PropertiesLauncher$ArchiveEntryFilter.class
    org/springframework/boot/loader/PropertiesLauncher$ClassPathArchives.class
    org/springframework/boot/loader/PropertiesLauncher$PrefixMatchingArchiveFilter.class
    org/springframework/boot/loader/PropertiesLauncher.class
    org/springframework/boot/loader/WarLauncher.class
    org/springframework/boot/loader/archive/
    org/springframework/boot/loader/archive/Archive$Entry.class
    org/springframework/boot/loader/archive/Archive$EntryFilter.class
    org/springframework/boot/loader/archive/Archive.class
    org/springframework/boot/loader/archive/ExplodedArchive$AbstractIterator.class
    org/springframework/boot/loader/archive/ExplodedArchive$ArchiveIterator.class
    org/springframework/boot/loader/archive/ExplodedArchive$EntryIterator.class
    org/springframework/boot/loader/archive/ExplodedArchive$FileEntry.class
    org/springframework/boot/loader/archive/ExplodedArchive$SimpleJarFileArchive.class
    org/springframework/boot/loader/archive/ExplodedArchive.class
    org/springframework/boot/loader/archive/JarFileArchive$AbstractIterator.class
    org/springframework/boot/loader/archive/JarFileArchive$EntryIterator.class
    org/springframework/boot/loader/archive/JarFileArchive$JarFileEntry.class
    org/springframework/boot/loader/archive/JarFileArchive$NestedArchiveIterator.class
    org/springframework/boot/loader/archive/JarFileArchive.class
    org/springframework/boot/loader/data/
    org/springframework/boot/loader/data/RandomAccessData.class
    org/springframework/boot/loader/data/RandomAccessDataFile$DataInputStream.class
    org/springframework/boot/loader/data/RandomAccessDataFile$FileAccess.class
    org/springframework/boot/loader/data/RandomAccessDataFile.class
    org/springframework/boot/loader/jar/
    org/springframework/boot/loader/jar/AbstractJarFile$JarFileType.class
    org/springframework/boot/loader/jar/AbstractJarFile.class
    org/springframework/boot/loader/jar/AsciiBytes.class
    org/springframework/boot/loader/jar/Bytes.class
    org/springframework/boot/loader/jar/CentralDirectoryEndRecord$Zip64End.class
    org/springframework/boot/loader/jar/CentralDirectoryEndRecord$Zip64Locator.class
    org/springframework/boot/loader/jar/CentralDirectoryEndRecord.class
    org/springframework/boot/loader/jar/CentralDirectoryFileHeader.class
    org/springframework/boot/loader/jar/CentralDirectoryParser.class
    org/springframework/boot/loader/jar/CentralDirectoryVisitor.class
    org/springframework/boot/loader/jar/FileHeader.class
    org/springframework/boot/loader/jar/Handler.class
    org/springframework/boot/loader/jar/JarEntry.class
    org/springframework/boot/loader/jar/JarEntryCertification.class
    org/springframework/boot/loader/jar/JarEntryFilter.class
    org/springframework/boot/loader/jar/JarFile$1.class
    org/springframework/boot/loader/jar/JarFile$JarEntryEnumeration.class
    org/springframework/boot/loader/jar/JarFile.class
    org/springframework/boot/loader/jar/JarFileEntries$1.class
    org/springframework/boot/loader/jar/JarFileEntries$EntryIterator.class
    org/springframework/boot/loader/jar/JarFileEntries$Offsets.class
    org/springframework/boot/loader/jar/JarFileEntries$Zip64Offsets.class
    org/springframework/boot/loader/jar/JarFileEntries$ZipOffsets.class
    org/springframework/boot/loader/jar/JarFileEntries.class
    org/springframework/boot/loader/jar/JarFileWrapper.class
    org/springframework/boot/loader/jar/JarURLConnection$1.class
    org/springframework/boot/loader/jar/JarURLConnection$JarEntryName.class
    org/springframework/boot/loader/jar/JarURLConnection.class
    org/springframework/boot/loader/jar/StringSequence.class
    org/springframework/boot/loader/jar/ZipInflaterInputStream.class
    org/springframework/boot/loader/jarmode/
    org/springframework/boot/loader/jarmode/JarMode.class
    org/springframework/boot/loader/jarmode/JarModeLauncher.class
    org/springframework/boot/loader/jarmode/TestJarMode.class
    org/springframework/boot/loader/util/
    org/springframework/boot/loader/util/SystemPropertyUtils.class
    BOOT-INF/
    BOOT-INF/classes/
    BOOT-INF/classes/com/
    BOOT-INF/classes/com/heeverse/
    BOOT-INF/classes/com/heeverse/config/
    BOOT-INF/classes/com/heeverse/config/VaultOperationService.class
    BOOT-INF/classes/com/heeverse/config/VaultEnvironmentConfig.class
    BOOT-INF/classes/com/heeverse/config/RdsConnectionProps.class
    BOOT-INF/classes/com/heeverse/config/SecurityConfig.class
    BOOT-INF/classes/com/heeverse/config/RdsConnectionProps$DBProps.class
    BOOT-INF/classes/com/heeverse/security/
    BOOT-INF/classes/com/heeverse/security/JsonAuthenticationFilter.class
    BOOT-INF/classes/com/heeverse/security/LoginAuthenticationProvider.class
    BOOT-INF/classes/com/heeverse/security/ClaimConstants.class
    BOOT-INF/classes/com/heeverse/security/JwtAuthenticationFilter.class
    BOOT-INF/classes/com/heeverse/security/JwtAuthenticationFilter$UrlProps.class
    BOOT-INF/classes/com/heeverse/security/Authority.class
    BOOT-INF/classes/com/heeverse/security/exception/
    BOOT-INF/classes/com/heeverse/security/exception/VaultTokenNotExistException.class
    BOOT-INF/classes/com/heeverse/security/exception/JwtParsingException.class
    BOOT-INF/classes/com/heeverse/security/exception/TokenExpiredException.class
    BOOT-INF/classes/com/heeverse/security/JwtTokenProvider.class
    BOOT-INF/classes/com/heeverse/concert/
    BOOT-INF/classes/com/heeverse/concert/dto/
    BOOT-INF/classes/com/heeverse/concert/dto/persistence/
    BOOT-INF/classes/com/heeverse/concert/dto/persistence/ConcertRequestMapperDto.class
    BOOT-INF/classes/com/heeverse/concert/dto/persistence/ConcertResponseMapperDto.class
    BOOT-INF/classes/com/heeverse/concert/dto/presentation/
    BOOT-INF/classes/com/heeverse/concert/dto/presentation/SearchConcertRequestDto.class
    BOOT-INF/classes/com/heeverse/concert/dto/presentation/SearchConcertResponseDto.class
    BOOT-INF/classes/com/heeverse/concert/dto/presentation/ConcertRequestDto.class
    BOOT-INF/classes/com/heeverse/concert/controller/
    BOOT-INF/classes/com/heeverse/concert/controller/ConcertController.class
    BOOT-INF/classes/com/heeverse/concert/service/
    BOOT-INF/classes/com/heeverse/concert/service/ConcertService.class
    BOOT-INF/classes/com/heeverse/concert/domain/
    BOOT-INF/classes/com/heeverse/concert/domain/entity/
    BOOT-INF/classes/com/heeverse/concert/domain/entity/Concert.class
    BOOT-INF/classes/com/heeverse/concert/domain/mapper/
    BOOT-INF/classes/com/heeverse/concert/domain/mapper/ConcertMapper.class
    BOOT-INF/classes/com/heeverse/concert/domain/FutureDate$List.class
    BOOT-INF/classes/com/heeverse/concert/domain/FutureDate.class
    BOOT-INF/classes/com/heeverse/concert/domain/FutureDateValidator.class
    BOOT-INF/classes/com/heeverse/concert/exception/
    BOOT-INF/classes/com/heeverse/concert/exception/ConcertTimeValidationException.class
    BOOT-INF/classes/com/heeverse/member/
    BOOT-INF/classes/com/heeverse/member/dto/
    BOOT-INF/classes/com/heeverse/member/dto/MemberRequestDto.class
    BOOT-INF/classes/com/heeverse/member/dto/LoginRequestDto.class
    BOOT-INF/classes/com/heeverse/member/controller/
    BOOT-INF/classes/com/heeverse/member/controller/MemberController.class
    BOOT-INF/classes/com/heeverse/member/service/
    BOOT-INF/classes/com/heeverse/member/service/MemberService.class
    BOOT-INF/classes/com/heeverse/member/domain/
    BOOT-INF/classes/com/heeverse/member/domain/entity/
    BOOT-INF/classes/com/heeverse/member/domain/entity/Member$MemberBuilder.class
    BOOT-INF/classes/com/heeverse/member/domain/entity/Member.class
    BOOT-INF/classes/com/heeverse/member/domain/mapper/
    BOOT-INF/classes/com/heeverse/member/domain/mapper/MemberMapper.class
    BOOT-INF/classes/com/heeverse/member/exception/
    BOOT-INF/classes/com/heeverse/member/exception/DuplicatedMemberException.class
    BOOT-INF/classes/com/heeverse/HeeverseTicketApplication.class
    BOOT-INF/classes/com/heeverse/common/
    BOOT-INF/classes/com/heeverse/common/DateAdapter.class
    BOOT-INF/classes/com/heeverse/common/Constants.class
    BOOT-INF/classes/com/heeverse/common/util/
    BOOT-INF/classes/com/heeverse/common/util/StringUtils.class
    BOOT-INF/classes/com/heeverse/common/util/RegexUtils.class
    BOOT-INF/classes/com/heeverse/common/BaseEntity.class
    BOOT-INF/classes/com/heeverse/common/AbstractPaging.class
    BOOT-INF/classes/com/heeverse/common/DateTarget.class
    BOOT-INF/classes/com/heeverse/common/PagingRequest.class
    BOOT-INF/classes/com/heeverse/common/Paging.class
    BOOT-INF/classes/com/heeverse/common/Sorting.class
    BOOT-INF/classes/com/heeverse/common/SerialTokenDto.class
    BOOT-INF/classes/com/heeverse/common/SerialNumber.class
    BOOT-INF/classes/com/heeverse/common/Delimiter.class
    BOOT-INF/classes/com/heeverse/common/exception/
    BOOT-INF/classes/com/heeverse/common/exception/SerialNumberException.class
    BOOT-INF/classes/com/heeverse/ticket/
    BOOT-INF/classes/com/heeverse/ticket/dto/
    BOOT-INF/classes/com/heeverse/ticket/dto/TicketRequestDto.class
    BOOT-INF/classes/com/heeverse/ticket/dto/GradeTicketDto.class
    BOOT-INF/classes/com/heeverse/ticket/dto/TicketGradeDto.class
    BOOT-INF/classes/com/heeverse/ticket/service/
    BOOT-INF/classes/com/heeverse/ticket/service/TicketService.class
    BOOT-INF/classes/com/heeverse/ticket/domain/
    BOOT-INF/classes/com/heeverse/ticket/domain/entity/
    BOOT-INF/classes/com/heeverse/ticket/domain/entity/OrderInfo.class
    BOOT-INF/classes/com/heeverse/ticket/domain/entity/Ticket.class
    BOOT-INF/classes/com/heeverse/ticket/domain/entity/GradeTicket.class
    BOOT-INF/classes/com/heeverse/ticket/domain/mapper/
    BOOT-INF/classes/com/heeverse/ticket/domain/mapper/GradeTicketMapper.class
    BOOT-INF/classes/com/heeverse/ticket/domain/mapper/TicketMapper.class
    BOOT-INF/classes/com/heeverse/ticket/domain/TicketSerialTokenDto.class
    BOOT-INF/classes/com/heeverse/ticket/domain/TicketSerialNumber.class
    BOOT-INF/classes/com/heeverse/ticket/exception/
    BOOT-INF/classes/com/heeverse/ticket/exception/DuplicatedTicketException.class
    BOOT-INF/classes/com/heeverse/venue/
    BOOT-INF/classes/com/heeverse/venue/Venue.class
    BOOT-INF/classes/schema.sql
    BOOT-INF/classes/mapper/
    BOOT-INF/classes/mapper/MemberMapper.xml
    BOOT-INF/classes/mapper/GradeTicketMapper.xml
    BOOT-INF/classes/mapper/TicketMapper.xml
    BOOT-INF/classes/mapper/ConcertMapper.xml
    BOOT-INF/classes/application-dev.yml
    BOOT-INF/classes/application-dev-test.yml
    BOOT-INF/classes/application-local.yml
    BOOT-INF/lib/
    BOOT-INF/lib/mybatis-spring-boot-starter-3.0.2.jar
    BOOT-INF/lib/spring-vault-core-3.0.2.jar
    BOOT-INF/lib/jjwt-impl-0.11.5.jar
    BOOT-INF/lib/jjwt-jackson-0.11.5.jar
    BOOT-INF/lib/jjwt-api-0.11.5.jar
    BOOT-INF/lib/h2-2.1.214.jar
    BOOT-INF/lib/mysql-connector-j-8.0.33.jar
    BOOT-INF/lib/spring-webmvc-6.0.10.jar
    BOOT-INF/lib/spring-security-web-6.1.1.jar
    BOOT-INF/lib/spring-web-6.0.10.jar
    BOOT-INF/lib/mybatis-spring-boot-autoconfigure-3.0.2.jar
    BOOT-INF/lib/mybatis-3.5.13.jar
    BOOT-INF/lib/mybatis-spring-3.0.2.jar
    BOOT-INF/lib/tomcat-embed-el-10.1.10.jar
    BOOT-INF/lib/hibernate-validator-8.0.0.Final.jar
    BOOT-INF/lib/spring-security-config-6.1.1.jar
    BOOT-INF/lib/spring-boot-autoconfigure-3.1.1.jar
    BOOT-INF/lib/spring-boot-3.1.1.jar
    BOOT-INF/lib/spring-security-core-6.1.1.jar
    BOOT-INF/lib/spring-context-6.0.10.jar
    BOOT-INF/lib/spring-aop-6.0.10.jar
    BOOT-INF/lib/HikariCP-5.0.1.jar
    BOOT-INF/lib/spring-jdbc-6.0.10.jar
    BOOT-INF/lib/spring-tx-6.0.10.jar
    BOOT-INF/lib/spring-beans-6.0.10.jar
    BOOT-INF/lib/spring-expression-6.0.10.jar
    BOOT-INF/lib/spring-core-6.0.10.jar
    BOOT-INF/lib/jackson-datatype-jsr310-2.15.2.jar
    BOOT-INF/lib/jackson-module-parameter-names-2.15.2.jar
    BOOT-INF/lib/jackson-annotations-2.15.2.jar
    BOOT-INF/lib/jackson-core-2.15.2.jar
    BOOT-INF/lib/jackson-datatype-jdk8-2.15.2.jar
    BOOT-INF/lib/jackson-databind-2.15.2.jar
    BOOT-INF/lib/jakarta.annotation-api-2.1.1.jar
    BOOT-INF/lib/snakeyaml-1.33.jar
    BOOT-INF/lib/tomcat-embed-websocket-10.1.10.jar
    BOOT-INF/lib/tomcat-embed-core-10.1.10.jar
    BOOT-INF/lib/micrometer-observation-1.11.1.jar
    BOOT-INF/lib/jakarta.validation-api-3.0.2.jar
    BOOT-INF/lib/jboss-logging-3.5.1.Final.jar
    BOOT-INF/lib/classmate-1.5.1.jar
    BOOT-INF/lib/logback-classic-1.4.8.jar
    BOOT-INF/lib/log4j-to-slf4j-2.20.0.jar
    BOOT-INF/lib/jul-to-slf4j-2.0.7.jar
    BOOT-INF/lib/slf4j-api-2.0.7.jar
    BOOT-INF/lib/spring-jcl-6.0.10.jar
    BOOT-INF/lib/micrometer-commons-1.11.1.jar
    BOOT-INF/lib/spring-security-crypto-6.1.1.jar
    BOOT-INF/lib/logback-core-1.4.8.jar
    BOOT-INF/lib/log4j-api-2.20.0.jar
    BOOT-INF/lib/spring-boot-jarmode-layertools-3.1.1.jar
    BOOT-INF/classpath.idx
    BOOT-INF/layers.idx
    
     ~/Library/Mobile Documents/com~apple~CloudDocs/f-lab/heeverse-ticket/build/libs  feat/31/github-action ⇡36 *4 +2 !2 ?1       base   15:59:17 
    ❯

JAR 구성

  1. META-INF

    • 스푸링 부트와 개발자의 소스 코드를 연결해주는 영역
    • MANIFEST.MF : 어플리케이션의 엔트리 포인트 정보가 있다. 스프링부트를 부팅하기 위한 JarLauncher 경로 정보와 main 메서드가 있는 클래스 경로 정보 있다.
  2. BOOT-INF

    • 개발자가 개발한 POJO 클래스 소스 코드와 환경 설정 파일
    • 의존성 jar 파일
  3. org

    스프링 부트를 로딩하기 위해 필요한 클래스 파일

Jar 실행 원리

  1. java -jar xxxx.jar 실행
  2. MANIFEST.MF 를 참고해 Main-Class 인 JarLauncher 를 호출한다.
  3. JarLauncher 가 MANIFEST.MF 를 참고해 메인메서드가 있는 Start-Class 를 호출한다.

0개의 댓글