Guest User

Untitled

a guest
Jul 25th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1. Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  2. 2018-07-25 18:51:12.870 ERROR 1504 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
  3.  
  4. ***************************
  5. APPLICATION FAILED TO START
  6. ***************************
  7.  
  8. Description:
  9.  
  10. Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
  11.  
  12. Reason: Failed to determine suitable jdbc url
  13.  
  14. Action:
  15.  
  16. Consider the following:
  17. If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
  18. If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
  19.  
  20. spring.jpa.hibernate.ddl-auto=update
  21. spring.jpa.generate-ddl=true
  22. spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL94Dialect
  23.  
  24. spring.datasource.driverClassName=org.postgresql.Driver
  25. spring.datasourse.url=jdbc:postgresql://localhost:5432/personal
  26. spring.datasourse.username=postgres
  27. spring.datasourse.pasword=root
  28.  
  29. spring.jpa.show-sql=true
  30. spring.session.store-type=none
  31.  
  32. @PostMapping
  33. public String add(@RequestParam String text,
  34. @RequestParam String tag, Map<String, Object> model) {
  35. messageRepo.save(new Message(text, tag));
  36.  
  37. Iterable<Message> messages = messageRepo.findAll();
  38.  
  39. model.put("messages", messages);
  40.  
  41. return "main";
  42. }
  43.  
  44. <dependencies>
  45. <dependency>
  46. <groupId>org.springframework.boot</groupId>
  47. <artifactId>spring-boot-starter-web</artifactId>
  48. </dependency>
  49. <dependency>
  50. <groupId>org.springframework.boot</groupId>
  51. <artifactId>spring-boot-starter-mustache</artifactId>
  52. </dependency>
  53. <dependency>
  54. <groupId>org.springframework.boot</groupId>
  55. <artifactId>spring-boot-devtools</artifactId>
  56. <optional>true</optional>
  57. </dependency>
  58. <dependency>
  59. <groupId>org.springframework.boot</groupId>
  60. <artifactId>spring-boot-starter-data-jpa</artifactId>
  61. <version>2.0.3.RELEASE</version>
  62. </dependency>
  63. <dependency>
  64. <groupId>org.postgresql</groupId>
  65. <artifactId>postgresql</artifactId>
  66. <scope>runtime</scope>
  67. </dependency>
  68. </dependencies>
  69.  
  70. <html>
  71. <body>
  72. <div>
  73. <form method="post">
  74. <input type="text" name="text" placeholder="Введіть повідомлення" />
  75. <input type="text" name="tag" placeholder="tag" />
  76. <button type="submit">Добавити</button>
  77.  
  78. </form>
  79. </div>
  80. <div>Список повідомлень</div>
  81. {{#messeges}}
  82. <div>
  83. <b>{{id}}</b>
  84. <span>{{text}}</span>
  85. <i>{{tag}}</i>
  86. </div>
  87. {{/messeges}}
  88. </body>
  89. </html>
  90.  
  91. @Entity
  92. public class Message {
  93. @Id
  94. @GeneratedValue(strategy = GenerationType.AUTO)
  95. private Integer id;
  96.  
  97. private String text;
  98. private String tag;
  99.  
  100. public Message() {
  101. }
  102.  
  103. public Message(String text, String tag) {
  104. this.text = text;
  105. this.tag = tag;
  106. }
  107.  
  108. public Integer getId() {
  109. return id;
  110. }
  111.  
  112. public void setId(Integer id) {
  113. this.id = id;
  114. }
  115.  
  116. public String getText() {
  117. return text;
  118. }
  119.  
  120. public void setText(String text) {
  121. this.text = text;
  122. }
  123.  
  124. public String getTag() {
  125. return tag;
  126. }
  127.  
  128. public void setTag(String tag) {
  129. this.tag = tag;
  130. }
  131. }
Add Comment
Please, Sign In to add comment