I have a rest service that does not work from tomcat container.Bellow are my pom.xml and classes.I would really appreciate some help.
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<artifactId>testcxf</artifactId>
<packaging>war</packaging>
testcxf
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
the spring boot class:
#SpringBootApplication
public class TestcxfApplication extends SpringBootServletInitializer{
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication.run(TestcxfApplication.class, args);
}
}
the server class:
#Configuration
public class webs {
#Autowired
private Bus bus;
#Bean
public Server cxfRestServer(Hello hello) {
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.setBus(bus);
factory.setProvider(new JacksonJsonProvider());
factory.setServiceBean(hello);
factory.setAddress("/rest");
return factory.create();
}
}
and the hello class.
The log is like this:
Starting TestcxfApplication v1.5.10.RELEASE on Marius with PID 34204
(started by MARIUS$ in C:\Program Files\Apache Software
Foundation\Tomcat 8.5) No active profile set, falling back to default
profiles: default Refreshing
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#4c65df69:
startup date [Mon Feb 12 16:17:09 EET 2018]; root of context hierarchy
Root WebApplicationContext: initialization completed in 288 ms Mapping
filter: 'errorPageFilter' to: [/*] Started TestcxfApplication in 0.879
seconds (JVM running for 4.531)
It says started but I can't access resources.I get 404 resources not found.
This shouldn't be needed:
#Configuration
public class webs {
#Autowired
private Bus bus;
#Bean
public Server cxfRestServer(Hello hello) {
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.setBus(bus);
factory.setProvider(new JacksonJsonProvider());
factory.setServiceBean(hello);
factory.setAddress("/rest");
return factory.create();
}
}
Let the CXF Spring Boot starter to handle it. Try also adding:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description</artifactId>
<version>${cxf.version}</version>
</dependency>
and this config in application.yml:
# Spring MVC dispatcher servlet path needs to be different than CXF's
server.servlet-path: /
# http://cxf.apache.org/docs/springboot.html#SpringBoot-SpringBootCXFJAX-RSStarter
cxf:
path: /api # CXFServlet URL pattern
jaxrs:
component-scan: true
I have detailed this configuration / setup in my blog at Implementing APIs using Spring Boot, CXF and Swagger.
Related
*Ehcache3 not working with spring boot - I tried out with approach given below. Spring boot never caches the value mentioned in the component.It is getting called n - no of times no matter the cache is enable or not. In the logs it shows cache is added to cache manager but thats not the case here
ehcache.xml
<ehcache:config>
<ehcache:cache-template name="myDefaultTemplate">
<ehcache:expiry>
<ehcache:none/>
</ehcache:expiry>
</ehcache:cache-template>
<ehcache:cache alias="customer" uses-template="myDefaultTemplate">
<ehcache:key-type>java.lang.Long</ehcache:key-type>
<ehcache:value-type>com.controller.Customer</ehcache:value-type>
<ehcache:expiry>
<ehcache:tti unit="seconds">30</ehcache:tti>
</ehcache:expiry>
<ehcache:heap unit="entries">200</ehcache:heap>
</ehcache:cache>
</ehcache:config>
In my pom.xml i have the following configurations -
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/>
</parent>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>test</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.6.2</version>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Application.java which starts spring boot app
#SpringBootApplication
#ComponentScan(basePackages = {"com.service"})
#EnableCaching
public class TestApplication {
public static void main(String[] args) {
SpringApplication.run(TestApplication.class, args);
}
}
Component class for caching -
#Component
public class CustomerService {
#Cacheable(cacheNames = "customer",key="#id")
public Customer getCustomer(final Long id){
System.out.println("Returning customer information for customer id
{}
"+id);
Customer customer = new Customer();
customer.setCustomerId(id);
customer.setFirstName("Test");
customer.setEmail("contact-us#test.com");
return customer;
}
}
I tried with couple of approaches by adding component scan in the application
but didn't worked out.
Spring boot starts and it shows cache has been added to cache manager.
I got it working by changing from #Component to #Service. I don't understand why caching is not working under component and works in service layer
If you want to add Caching annotation at the Repository layer then just remove #Repository Annotation, If you want to add Caching at Service Layer then use #Service Annotation instead of #Component Annotation.
When I try to deploy my .war project (Spring Boot) on a Tomcat server I get the following exception on the logs. Note that this exception doesn't happen locally, so I can only reproduce it on server enviroment.
Complete stacktrace https://pastebin.com/8uFqwk0U
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mappingComponent': Failed to introspect bean class [com.project.components.MappingComponent] for lookup method metadata: could not find class that it depends on; nested exception is java.lang.NoClassDefFoundError: java/time/temporal/Temporal
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:269) ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]
I searched of course about this issue and I've changed some dependencies on ton pom.xml, also removed and added constructors just in case but I couldn't figure out why this is happening.
MappingComponent the calss that exception happens
#Component
public class MappingComponent {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
#Autowired
Repository1 repo1;
#Autowired
Repository2 repo2;
//no constructors
//methods that are using the repositories
}
MappingController the class that injects MappingComponent
#RestController
#CrossOrigin
#RequestMapping("/services")
public class MappingController {
#Autowired
private ClientComponent clientComponent;
#Autowired
private MappingComponent mappingComponent;
//no constructors
//services that are using the components
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>services</groupId>
<artifactId>services</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>services</name>
<description>Services</description>
<packaging>war</packaging>
<properties>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Main class
#SpringBootApplication
public class ServicesApplication extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ServicesApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(ServicesApplication.class, args);
}
}
I am aware that both java and spring are outdated, but it doesn't depend on me to upgrade them to a newer version. And that's not the issue because there are other services deployed with the same version (and identical pom.xml).
Temporal class has been introduced only in 1.8 and in your pom I see that you use 1.7.
When you are not sure of when a class has been introduced, just check in the Javadoc the #Since tag.
You might need to external the external dependency jar into the lib directory of the Tomcat web server. First shutdown tomcat, add jar to the lib directory, and then startup tomcat.
I trying to build a simple welcome page (in jsp) using Spring Boot.
Below is the project structure
Application
#SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
public SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
}
APIController
#Controller
public class APIController {
#RequestMapping("/")
public String home() {
System.out.println("testing");
return "welcome";
}
}
When I access http://localhost:8080/, I get below error
This application has no explicit mapping for /error, so you are seeing
this as a fallback.
Wed May 23 15:31:51 MYT 2018 There was an unexpected error (type=Not
Found, status=404). No message available
By curl
{"timestamp":1527061233703,"status":404,"error":"Not Found","message":"No message available","path":"/"}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-boot-web-jsp</artifactId>
<packaging>war</packaging>
<name>Spring Boot Web JSP Example</name>
<description>Spring Boot Web JSP Example</description>
<version>1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- This is a web application -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!-- Optional, test for static content, bootstrap CSS-->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Package as an executable jar/war -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
You have to define the prefix and suffix for you jsp file in application.properties file like following:
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
In directory \src\main\resources\static, Create a simple index.html file
<html>
<head>Hello, Bich Van</head>
<body>
<h3>Today is a rainny day</h3>
</body>
</html>
Then try again at http://localhost:8080
If you don't like static HTML files, you can use JSP, but need a little complicate. You need declaring JSP View resolver in Spring MVC configuration.
Reference document: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-web-applications.html#boot-features-spring-mvc-welcome-page
Ensure that you have jasper and jstl in the list of dependencies:
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
Here is a working starter project - https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-web-jsp
It's better to use thymeleaf in your spring boot project and add the following dependency
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
In directory \src\main\resources\template, Create a simple index.html file
I am trying to run a simple spring boot app in a stand-alone tomcat. I've tried following the reference docs and a few question/answers here but nothing seems to work. When tomcat starts up it deploys the app but completely ignores my Application class so no spring code gets loaded. I am sure it must be something simple I'm missing but...?
Here's the relevant output in the log file:
INFO: Deploying web application archive C:\dev\servers\apache-tomcat-7.0.75\webapps\bankweb-0.1.war
Feb 15, 2017 4:41:45 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list o
f JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and
JSP compilation time.
Feb 15, 2017 4:41:45 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive C:\dev\servers\apache-tomcat-7.0.75\webapps\bankweb-0.1.war has finished in 3,595
ms
I've updated the Application class to extend SpringBootServletInitializer as per the docs:
#Configuration
#EnableAutoConfiguration
#ComponentScan
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(applicationClass, args);
}
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(applicationClass);
}
private static Class<Application> applicationClass = Application.class;
}
#RestController
class GreetingController {
#RequestMapping("/hello/{name}")
String hello(#PathVariable String name) {
return "Hello, " + name + "!";
}
}
And in the pom I've changed packaging to war and marked the embedded servlet container as provided:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.ankle</groupId>
<artifactId>bankweb</artifactId>
<version>0.1</version>
<packaging>war</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.7</java.version>
<tomcat.version>7.0.69</tomcat.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
This is resolved, user error pretty much sums it up. I stripped everything back to remove all the optional spring modules, got it working, then added everything in bit by bit and it worked. I am not really accustomed to this spring boot stuff yet where functionality gets included just because you've configured a library in the pom. Thanks to anyone who took the time to read!
if i call the default url for my tomcat server, i will see an error 404. The program is running without any problems, but perhaps the restcontroller is disabled (i don't known, normally not). There are no erros in the log. The start page is a html-format. I set the default path (see below).
Im using Spring Boot and tomcat7.
The requested resource (/dashboard/) is not available.
Spring Boot path src\main\resources\templates\index.html
Index.html path in war: ..\tomcat7\webapps\dashboard\WEB-INF\classes\templates\index.html
Main
#Configuration
#EnableAutoConfiguration
#ComponentScan(basePackages = "com.###.dashboard")
#EnableJpaRepositories
#EntityScan(basePackages = "com.###.dashboard.domain")
public class Dashboard extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(new Object[] {Dashboard.class, DashboardController.class}, args);
}
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Dashboard.class);
}
}
RestController
#RestController
public class DashboardController {
/**
*...
*/
#RequestMapping("/")
public String setPage(Model model) {
// ...
return "index";
}
}
pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.###.dashboard</groupId>
<artifactId>Dashboard</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>Dashboard</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.8.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-mobile</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<start-class>com.###.dashboard.main.Dashboard</start-class>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
tomcat7 server
2014-12-05 13:31:46.836 INFO 28052 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[],param
s=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.###.dashboard.domain.DashboardController.setPage(org.springframework.ui.Model)
Thank you
try to put templates in src/main/resources/templates (it's another default path for spring boot)
it works for me and resources/templates sounds better than resources/resources :)
Try annotating your controller as #Controller and give '/dashboard' default request mapping to the controller so that the dashboard controller can answer to the requests with uri starting as '/dashboard'
#Controller
#RequestMapping("/dashboard")
public class DashboardController
Use debug points to see whether the request has fallen thourgh your controller pipeline, white page might be related to an empty template
It means your spring container is not able to find the default page. Just add your home page into the src or make a proper redirection of the home page. For the testing purpose you can use the complete mapping on the web where you have put the home page.
With below changes it worked.
I commented out spring-boot-starter-thymeleaf because it was asking to put some templates to /templates folder.
After that i added #ResponseBody to RequestMapping to return String.
#RequestMapping("/")
public #ResponseBody String setPage(Model model) {
return "index";
}
So maybe you have problem with spring-boot-starter-thymeleaf
Note: I started the tomcat using spring-boot-maven-plugin plugin in your pom with command line mvn spring-boot:run
Here's quite so many get errors while working with Tomcat7 without MAVEN like adding hibernate validator and hibernate dependencies in spring notice one thing update your eclipse. And shift to Tomcat 8 it is set up with API-3.0 so every hibernate component works with it. Even some error doubts just free to ask me.
#navajavadevolper