Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.st.spring.boot.controller;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.GetMapping;
- @Controller
- public class HelloWorldController {
- @Value("${custom.prop}")
- private String var;
- @GetMapping("/helloWorld")
- public String helloWorld(Model model) {
- model.addAttribute("name", "Spring Boot");
- return "helloWorldDynamic";
- }
- }
- package com.st.spring.boot;
- import org.springframework.boot.SpringApplication;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
- @SpringBootApplication
- public class Application {
- public static void main(String[] args) {
- SpringApplication.run(Application.class, args);
- }
- }
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>1.5.3.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-tomcat</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>4.6.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.webjars</groupId>
- <artifactId>bootstrap</artifactId>
- <version>3.3.7</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- </dependency>
- <!-- tomcat-embed-jasper is needed for jsp rendering -->
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-jasper</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <properties>
- <java.version>1.8</java.version>
- </properties>
- spring.mvc.view.prefix: /WEB-INF/jsp/
- spring.mvc.view.suffix: .jsp
- server.port: 8081
- custom.prop: Spring Boot Custom Property
- 2m2019-05-24 16:47:58.050 INFO 4244 --- [nio-8081-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
- 2019-05-24 16:47:58.050 INFO 4244 --- [nio-8081-exec-2] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
- 2019-05-24 16:47:58.107 INFO 4244 --- [nio-8081-exec-2] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 57 ms
- 2019-05-24 16:48:02.679 ERROR 4244 --- [nio-8081-exec-2] o.a.c.c.C.[.[localhost].[/].[jsp] : Servlet.service() for servlet jsp threw exception
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement