계속 매핑이 안돼서 뭐가 문제인가 찾아보는데

서버 재시작 하니까 적용됨

 

에러

the import javax.annotation.resource cannot be resolved

 

원인

 javax.annotation.resource 가 import 되지 않아서

 

해결

pom.xml 파일에 

<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.1</version>
</dependency>

추가

1. web.xml 파일에서 DispatcherServlet 선언 확인

 


<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

/ > /* 변경

 

 

2. servlet-context.xml 파일 확인

 

<mvc:annotation-driven />


<context:component-scan base-package="com.spring.board* " />

 

3. url mapping 확인 

 

controller.java 파일에서 

@RequestMapping(value = "/sample") 

 

 

Project 우클릭 > Properties > Java build path > Add Library > Class path에 junit 추가

 

 

에러

table 생성했는데 에러코드 1146 발생함

 

해결

테이블명에 . (온점)이 있어서 그럼

테이블명 변경

 

 

에러

Java compiler level does not match the version of the installed Java project facet.

 

원인

사용하는 java 버전과 이클립스 설정된 버전이 일치하지 않아서 발생하는 에러

 

해결

project 우클릭 > properties > project factes > 사용하고 있는 java 버전으로 변경

 

 

에러

cvc-id.3: a field of identity constraint 'web-app-filter-name-uniqueness' matched element 'web-app', but this element does not have a simple

 

 

해결

web.xml 상단 http://java.sum.com 부분에서 java를 JAVA 또는 Java로 변경

 

이유가 뭐지

 

resource specification not allowed here for source level below 1.7

 

1.7 이상의 컴파일 환경임에도 1.7 이하의 버전이 환경설정에 적용되어 발생하는 에러

 

해결방법

 

1) pom.xml 파일 수정

1.7 이상 버전으로 수정

 

            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>11.0.1</source>
                    <target>11.0.1</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>

 

 

 

2) project 우클릭 > properties > build path > Java Build Path > Libraries 탭 > JRE1.6~1.7 버전 있으면 삭제 후 Add Library 클릭 > JRE Sysem Library 추가 

 

3) project 우클릭 > properties > build path > Java Compiler > JDK 버전 변경 

 

1. 다운로드

Mybatis 3.4.6 버전  jar 파일 다운로드

https://mvnrepository.com/artifact/org.mybatis/mybatis/3.4.6

 

Mybatis-spring jar 다운로드

https://mvnrepository.com/artifact/org.mybatis/mybatis-spring/1.3.2

 

 

mybatis 연동

https://techhan.github.io/study/spring-07/

 

[spring] MyBatis 연동하기

코드로 배우는 스프링 웹 프로젝트

techhan.github.io

 

2. 의존성 추가

 

프로젝트 내 pom.xml 파일 라이브러리 추가

 

<!-- Spring JDBC -->

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-jdbc</artifactId>

<version>${org.springframework-version}</version>

</dependency>

 

<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->

<dependency>

    <groupId>org.mybatis</groupId>

    <artifactId>mybatis</artifactId>

    <version>3.4.6</version>

</dependency>

 

<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->

<dependency>

    <groupId>org.mybatis</groupId>

    <artifactId>mybatis-spring</artifactId>

    <version>1.3.2</version>

</dependency>

https://kotlinworld.com/64

 

의존성 주입이란 무엇이며 왜 필요한가?

목표 의존성 주입이 무엇인지 이해한다. 의존성 주입이 왜 필요한지 이해한다. 의존성 주입이란? 의존성 주입이란 클래스간 의존성을 클래스 외부에서 주입하는 것을 뜻한다. 더 자세하게는 의

kotlinworld.com

 

+ Recent posts