Reputation: 163
Am getting filename.java:6: error: package org.springframework.boot.context.web does not exist import org.springframework.boot.context.web.SpringBootServletInitializer;
Source code :--
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
build.gradle :--
buildscript {
ext {
springBootVersion = '2.0.0.BUILD-SNAPSHOT'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
war {
baseName = 'temp'
version = '0.0.2'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile("org.springframework.boot:spring-boot-starter-jdbc")
compile("com.h2database:h2")
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile("junit:junit")
testCompile('org.springframework.security:spring-security-test')
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
}
Any pointers would be very helpful. Is there a missing starter dependency...
Upvotes: 1
Views: 1423
Reputation: 116091
You are using Spring Boot 2.0 where SpringBootServletInitializer
is in the org.springframework.boot.web.servlet.support
package.
Upvotes: 1