Spring boot 프로젝트 통합 my batis, xml 정적 자원 파일 의 배치 및 경로 설정 문제

3299 단어 개발 도구
springboot 과 my batis 를 통합 할 때 mapper 파일 을 resource 에 두 어야 한 다 는 것 을 알 게 되 어 일부 사람들 에 게 익숙 하지 않 습 니 다.그럼 해결책 을 말씀 드 리 겠 습 니 다.그리고 사용 중인 작은 구덩이: Intellij IDEA 에서 src 폴 더 에 있 는 xml 를 식별 할 수 없습니다.
Eclipse 에서:
#mybatis        
mybatis.config-location:classpath:mybatis-config.xml
#   mapper    
mybatis.mapper-locations:classpath*:com/springboot/mapper/*.xml

IDEA 에서:
pom. xml 에 다음 설정 을 추가 하면 됩 니 다. (테스트 패키지 건 너 뛰 기: clean package - DMaven. test. skip = true
	<build>
			<resources>
				<!--     ,       mapper          -->
				<resource>
					<directory>src/main/java</directory>
					<includes>
						<include>**/*.properties
						**/*.xml</include>
					</includes>
					<filtering>false</filtering>
				</resource>
			</resources>
	</build>

Tips: 프로젝트 가 시작 되 지 않 으 면 * * "Unable to start embedded container" * * 를 보고 하면 탭 을 삭제 하고 시작 후 탭 을 추가 하여 다시 시작 하면 해 결 됩 니 다. 신의 동작, 모 르 는 것 은 묻 지 마 세 요. -.

좋은 웹페이지 즐겨찾기