Git Product home page Git Product logo

spring-demo's Introduction

Spring Demo

  • IDE : IntelliJ
  • 구성 : Spring + MyBatis + Gradle + Java Configuration
  • WAS : Tomcat
  • Library : Spring 4.x, mybatis, mysql-connector, log4j, lombok, jackson
  • API 개발 (프론트 개발 X)

1. 구조

  • Controller, Service, Persistence, config, domain으로 구성
  • xml 기반 설정이 아닌 자바 코드 기반 설정
  • JDBC 대신 persistence 프레임워크 MyBatis 사용
  • User에 대한 CRUD를 수행하는 API 개발

1-1. Controller

UserController는 JSON 기반의 Rest API 서비스를 제공한다. @Controller와 @ResponseBody의 기능을 합친 @RestController를 사용한다.

1-2. Service

UserService는 User의 CRUD(회원가입, 유저 조회, 삭제)에 관한 독립적인 기능을 하는 @Service 컴포넌트이다. DAO(Persistence)에 DB의 CURD 처리를 위임하고, 그 결과를 Controller에 반환한다. Service 레이어에서는 @Transactional 어노테이션을 사용하여 간단한 트랜잭션 처리를 하고, 추가적으로 단순 읽기 작업에 대해선 @Transactional(readOnly = true)를 추가해준다.

1-3. Persistence

퍼시스턴스 프레임워크 MyBatis를 사용한다. DAO역할의 UserMapper는 @Repository 컴포넌트이다. Mapper Interface 방식과 Annotation 방식을 이용하여 구현한다.

1-4. config, domain

자바 코드 기반의 설정 방법을 사용하여 DatabaseConfig Class와 MyBatisConfig Class가 있다.

spring-demo's People

Contributors

choe061 avatar

Watchers

James Cloos avatar Sangkyun Yoon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.