Notice
Recent Posts
Recent Comments
Link
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

Been_DevStep

Project Dir및 기초 설정 본문

공부

Project Dir및 기초 설정

JChBeen 2022. 10. 26. 16:04

 

Home Director 을 기준으로

controllers → XController

                   @Controller(value = "packge.XController")

 

entites → DBTableName.(XEntity)

mappers → IXMapper

                    @Mapper

services → Xservice

                   @Service(value = "packge.XController")

 

rescources Director을 기준으로

mappers → XMppaer.xml

<mapper namespace="package.IXMapper">

static → X.resoucre.scripts.(index.js)

         → X.resoucres.stylesheets.(index.css)

templates → X.(index.html)

 

 

 

 

Controller에 Service의 의존성을 설정합니다.

XController에

private final XService xService;

@Autowired
public XController(XService xService){
    this.xService = xService;
}

 

위와 같이 Service에도 Mapper Interface에 의존성을 설정합니다.

private IXMapper iXMapper;

@Autowired
public MemberService(IXMapper iXMapper){
    this.iXMapper = iXMapper;
}

 

pom.xml에서 의존성 적용 // MariDB, MyBatis

 

application.properties 에서 MyBatis mapper설정 ( Google 에서 mybatis mapper dtd 검색  'mapper 있는 걸로')

mybatis.mapper-locations=classpath:mappers/**/*.xml

spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mariadb://localhost:12602
spring.datasource.username=study
spring.datasource.password=test1234

 

Comments