关于java -classpath 无法加载spring mybaties问题
写了个独立程序 不是WEB的, java socket server , spring+mybaties
context = new ClassPathXmlApplicationContext("classpath*:spring-*.xml"); //这样加载没问题
但是 不扫描 service组件,用eclipse直接运行没任何问题。
<context:component-scan base-package="com.mycore.service"
use-default-filters="false">
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Service" />
</context:component-scan>
好像也没加载mybaties mapping配置文件
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:mybatis-config.xml" />
<property name="mapperLocations" value="classpath*:db/mapping/*.xml" />
</bean>
使用方法是 java -classpath 很多jar文件 classname 。
有朋友遇到过么,应该是加载spring xml的问题。