Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. package com.st.spring.boot.controller;
  2. import org.springframework.beans.factory.annotation.Value;
  3. import org.springframework.stereotype.Controller;
  4. import org.springframework.ui.Model;
  5. import org.springframework.web.bind.annotation.GetMapping;
  6.  
  7. @Controller
  8. public class HelloWorldController {
  9. @Value("${custom.prop}")
  10. private String var;
  11. @GetMapping("/helloWorld")
  12. public String helloWorld(Model model) {
  13. model.addAttribute("name", "Spring Boot");
  14. return "helloWorldDynamic";
  15. }
  16. }
  17.  
  18. package com.st.spring.boot;
  19. import org.springframework.boot.SpringApplication;
  20. import org.springframework.boot.autoconfigure.SpringBootApplication;
  21.  
  22. @SpringBootApplication
  23. public class Application {
  24.  
  25. public static void main(String[] args) {
  26. SpringApplication.run(Application.class, args);
  27. }
  28. }
  29.  
  30. <parent>
  31. <groupId>org.springframework.boot</groupId>
  32. <artifactId>spring-boot-starter-parent</artifactId>
  33. <version>1.5.3.RELEASE</version>
  34. </parent>
  35. <dependencies>
  36. <dependency>
  37. <groupId>org.springframework.boot</groupId>
  38. <artifactId>spring-boot-starter-web</artifactId>
  39. </dependency>
  40. <dependency>
  41. <groupId>org.springframework.boot</groupId>
  42. <artifactId>spring-boot-starter-tomcat</artifactId>
  43. <scope>provided</scope>
  44. </dependency>
  45. <dependency>
  46. <groupId>org.eclipse.jdt.core.compiler</groupId>
  47. <artifactId>ecj</artifactId>
  48. <version>4.6.1</version>
  49. <scope>provided</scope>
  50. </dependency>
  51. <dependency>
  52. <groupId>org.webjars</groupId>
  53. <artifactId>bootstrap</artifactId>
  54. <version>3.3.7</version>
  55. </dependency>
  56. <dependency>
  57. <groupId>javax.servlet</groupId>
  58. <artifactId>jstl</artifactId>
  59. </dependency>
  60. <!-- tomcat-embed-jasper is needed for jsp rendering -->
  61. <dependency>
  62. <groupId>org.apache.tomcat.embed</groupId>
  63. <artifactId>tomcat-embed-jasper</artifactId>
  64. <scope>provided</scope>
  65. </dependency>
  66. </dependencies>
  67. <properties>
  68. <java.version>1.8</java.version>
  69. </properties>
  70.  
  71. spring.mvc.view.prefix: /WEB-INF/jsp/
  72. spring.mvc.view.suffix: .jsp
  73. server.port: 8081
  74. custom.prop: Spring Boot Custom Property
  75.  
  76. 2m2019-05-24 16:47:58.050 INFO 4244 --- [nio-8081-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
  77. 2019-05-24 16:47:58.050 INFO 4244 --- [nio-8081-exec-2] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
  78. 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
  79. 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