0
私は以前に成功したTomcatのspringbootで生成された戦争を展開しようとしていますが、今回は何が間違っているのか分かりません。TomcatのSpringboot戦闘が動作しない
最も重要なコードが追加されます:
config/AppConfig
@Configuration
@EnableTransactionManagement
@Component
//@EnableWebMvc
@ComponentScan("com.singleuseapps")
public class AppConfig {
LaptopsApplication
@SpringBootApplication
@ComponentScan(basePackageClasses = {AppConfig.class,LaptopsApplication.class})
public class LaptopsApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(LaptopsApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(LaptopsApplication.class, args);
}
build.gradle
buildscript {
ext {
springBootVersion = '1.4.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'idea'
apply plugin: 'war'
springBoot{
executable = true
}
jar {
baseName = 'laptops'
}
war {
baseName = 'laptops'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile 'org.hibernate:hibernate-core:5.0.9.Final'
compile("com.h2database:h2")
testCompile('org.springframework.boot:spring-boot-starter-test')
compile 'javax.servlet:javax.servlet-api:3.1.0'
compile 'org.javassist:javassist:3.15.0-GA'
compile 'mysql:mysql-connector-java:5.1.31'
compile 'commons-dbcp:commons-dbcp:1.4'
compile('org.springframework.boot:spring-boot-starter-jdbc')
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
compileOnly "org.projectlombok:lombok:1.16.10"
compile "io.springfox:springfox-swagger2:2.6.0"
compile 'io.springfox:springfox-swagger-ui:2.6.0'
compile 'com.sun.mail:javax.mail'
compile('org.springframework.boot:spring-boot-starter-mail')
}
誰かが私が失敗した理由を知りたいと思っています。
[編集]
ラインcatalina.outで
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.singleuseapps.LaptopsApplication]; nested exception is java.io.FileNotFoundException: class path resource [com/singleuseapps/cart/TestMailController.class] cannot be opened because it does not exist
あなたは – davidxxx
は、私が手正確なエラーを与えるべきであるあなたの2つの@ComponentScanのアノテーションで指定されたパッケージであることを確認し、それを追加しますtomcatのエンドポイントをテストするときは404です – Stefan
展開フェーズでエラーはありませんか? – davidxxx