Been_DevStep
Project Dir및 기초 설정 본문
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