---
title: "[转]Spring Component-scan和eclipse export jar兼容问题"
author: "badwing"
date: "2012-03-08T20:39:06Z"
tags: []
categories: ["开源软件"]
slug: "spring-component-scan-eclipse-export-jar"
draft: false
lastmod: "2012-03-08T20:39:06Z"
id: 1447033
url: "https://badwing.iteye.com/blog/1447033"
---

Spring使用component-scan的时候，如果把spring bean打包到jar文件中，spring无法找到相应的bean

要处理正确很简单：当使用eclipse export成.jar的时候，把add directory entries选上就可以了

或者使用下列打包方法：

jar cvf jj.jar com META-INF jdbc.properties beans.xml