두 개 이상 Autowired 사용할 때

각각 다 써주어야 한다.


틀린 예)

@Autowired

A a

B b



맞는 예)

@Autowired

A a


@Autowired

B b



insert, delete, update


commit했나 확인해보자..

'공부 > DB' 카테고리의 다른 글

Microsoft SQL Server stored procedure select값 가져오기  (0) 2018.08.12
ORA-00984: column not allowed here  (0) 2018.02.13
table, sequence 만들기 예제  (0) 2018.01.23
Oracle SQL 01 select 기초  (0) 2018.01.11

Spring 연결


1. 프로젝트 만들기

src/main/java

src/main/resources

wepapp 변경, web.xml 체크하고 Finish.


2. Configure - Maven으로 변경


3. pom.xml

 - Spring dependencies 추가


4. web.xml

 - DispatcherServlet 정의, Context Listener 등록, 인코딩 처리


5. /WEB-INF/spring-servlet.xml

 - Annotation, Controller 설정


6. /WEB-INF/applicationContext.xml


7. jsp, Controller 작성


8. Tomcat에 올림


9. 돌아가는지 확인




DB 연결


1. pom.xml

- Oracle, JDBC, MyBatis 추가. Oracle은 repository도 추가해주어야 함.


2. applicationContext.xml

- Oracle 접속설정, MyBatis SqlSession 추가.


3. mybatis packages

java/main/resources 아래 mybatis, mybatis.mappers 추가


폴더로 나오면 -> properties - Java Build Path - Source - Excluded Remove.


4. configuration.xml

mybatis 아래 configuration.xml - mappers 경로 정의


5. queries

mybatis.mappers 아래 알맞은 쿼리 xml 파일 작성




파일 업로드


1. pom.xml

Jackson, commons fileupload 다운


2. spring-servlet.xml

mvc:annotation-driven 밑에 message-converter 추가

multipartResolver 추가

url 매핑 추가




applicationContext.xml

pom.xml

spring-servlet.xml

web.xml