我的spring-boot应用程序有问题,因为当我使用Jar下一个maven构建时我无法启动它。但我可以在我的IDE中启动它......
例外是:
java.lang.ClassNotFoundException: org.springframework.data.repository.CrudRepository
我的POM.XML
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
当我查看jar文件时,我有一个文件夹lib /,其中包含spring-boot-start-data-jpa-1.2.5.RELEASE.jar,所以我不明白为什么jar无法找到CrudRepository ...
任何想法? 非常感谢你
修改
jar内容中的我的lib文件夹:
antlr-2.7.7.jar
aopalliance-1.0.jar
asm-3.3.1.jar
aspectjrt-1.8.6.jar
aspectjweaver-1.8.6.jar
classmate-1.0.0.jar
cxf-core-3.0.3.jar
cxf-rt-bindings-soap-3.0.3.jar
cxf-rt-bindings-xml-3.0.3.jar
cxf-rt-databinding-jaxb-3.0.3.jar
cxf-rt-frontend-jaxws-3.0.3.jar
cxf-rt-frontend-simple-3.0.3.jar
cxf-rt-transports-http-3.0.3.jar
cxf-rt-ws-addr-3.0.3.jar
cxf-rt-ws-policy-3.0.3.jar
cxf-rt-wsdl-3.0.3.jar
dom4j-1.6.1.jar
guava-18.0.jar
hibernate-commons-annotations-4.0.5.Final.jar
hibernate-core-4.3.10.Final.jar
hibernate-entitymanager-4.3.10.Final.jar
hibernate-jpa-2.1-api-1.0.0.Final.jar
hibernate-validator-5.1.3.Final.jar
jackson-annotations-2.4.6.jar
jackson-core-2.4.6.jar
jackson-databind-2.4.6.jar
jandex-1.1.0.Final.jar
javassist-3.18.1-GA.jar
javax.transaction-api-1.2.jar
jaxb-core-2.2.10-b140310.1920.jar
jaxb-impl-2.2.10-b140310.1920.jar
jboss-logging-3.1.3.GA.jar
jboss-logging-annotations-1.2.0.Beta1.jar
jcl-over-slf4j-1.7.12.jar
jul-to-slf4j-1.7.12.jar
log4j-over-slf4j-1.7.12.jar
logback-classic-1.1.3.jar
logback-core-1.1.3.jar
neethi-3.0.3.jar
ojdbc6-11.2.0.jar
slf4j-api-1.7.12.jar
snakeyaml-1.14.jar
spring-aop-4.1.7.RELEASE.jar
spring-aspects-4.1.7.RELEASE.jar
spring-beans-4.1.7.RELEASE.jar
spring-boot-1.2.5.RELEASE.jar
spring-boot-autoconfigure-1.2.5.RELEASE.jar
spring-boot-starter-1.2.5.RELEASE.jar
spring-boot-starter-aop-1.2.5.RELEASE.jar
spring-boot-starter-data-jpa-1.2.5.RELEASE.jar
spring-boot-starter-jdbc-1.2.5.RELEASE.jar
spring-boot-starter-logging-1.2.5.RELEASE.jar
spring-boot-starter-tomcat-1.2.5.RELEASE.jar
spring-boot-starter-web-1.2.5.RELEASE.jar
spring-boot-starter-ws-1.2.5.RELEASE.jar
spring-context-4.1.7.RELEASE.jar
spring-core-4.1.7.RELEASE.jar
spring-data-commons-1.9.3.RELEASE.jar
spring-data-jpa-1.7.3.RELEASE.jar
spring-expression-4.1.7.RELEASE.jar
spring-jdbc-4.1.7.RELEASE.jar
spring-jms-4.1.7.RELEASE.jar
spring-messaging-4.1.7.RELEASE.jar
spring-orm-4.1.7.RELEASE.jar
spring-oxm-4.1.7.RELEASE.jar
spring-tx-4.1.7.RELEASE.jar
spring-web-4.1.7.RELEASE.jar
spring-webmvc-4.1.7.RELEASE.jar
spring-ws-core-2.2.1.RELEASE.jar
spring-ws-support-2.2.1.RELEASE.jar
spring-xml-2.2.1.RELEASE.jar
stax2-api-3.1.4.jar
tomcat-embed-core-8.0.23.jar
tomcat-embed-el-8.0.23.jar
tomcat-embed-logging-juli-8.0.23.jar
tomcat-embed-websocket-8.0.23.jar
tomcat-jdbc-8.0.23.jar
tomcat-juli-8.0.23.jar
validation-api-1.1.0.Final.jar
woodstox-core-asl-4.4.1.jar
wsdl4j-1.6.3.jar
xml-apis-1.0.b2.jar
xml-resolver-1.2.jar
xmlschema-core-2.1.0.jar
答案 0 :(得分:0)
我终于解决了我的问题。
我正在使用Guava查找@WebService注释的所有类,并创建bean。但是所有豆子都没有加载。所以我现在使用ClassPathScanningCandidateComponentProvider,它在Spring停止时休眠以创建bean。
感谢您的回答