私はSpringには新しく、Jettyコンテナ内の古い3.2.4.RELEASEバージョンで作業しています。@Configurationアノテーションが原因でIllegalArgumentExceptionが発生する「拡張クラスではない」
Caused by: java.lang.IllegalArgumentException: class com.datasource.DBConfiguration$$EnhancerByCGLIB$$8a295c55 is not an enhanced class
at org.springframework.cglib.proxy.Enhancer.setCallbacksHelper(Enhancer.java:621) ~[spring-core-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.cglib.proxy.Enhancer.registerStaticCallbacks(Enhancer.java:594) ~[spring-core-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:120) ~[spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:92) ~[spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:356) ~[spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
... 78 common frames omitted
私の春の豆ファイルをクラスパスとルックスである:私は私が設定した@Configurationクラスが拡張クラスではないことを示すコンポーネント・スキャナを使用しようとすると、私はむしろ奇妙なエラーを取得しています次
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:component-scan base-package="com.datasource" /></beans>
のように私はセットアップにしようとしているコンフィギュレーションクラスは、次のようになります。
@Configuration
public class DBConfiguration {
@Bean
public DataAccessInterface getDataAccessInterface(){
return new DBDatasource();
}
}
私はトンのようなルックスにDBDatasourceを注入するクラス彼は次のようになります:
@Service
public class DBService {
private DataAccessInterface dai;
@Autowired
public DBService(DataAccessInterface dai){
this.dai = dai;
}
}
拡張クラスではないと言うとき、例外は何を意味しますか?コンポーネントスキャンと構成注釈を適切に使用していませんか?
あなたのpom.xmlを投稿することができますが含まれてください!私はそれがあなたが使用するCGLibバージョンの競合のcozかもしれないと思います。またそれはOSGiですか? –
OSGIを使用していない私が知っている限り、クラスパスにはorg.osgi.core-4.1.0.jarとcglib-nodep-2.2.jarがあります – rhunter