Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
- 2018-07-25 18:51:12.870 ERROR 1504 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
- ***************************
- APPLICATION FAILED TO START
- ***************************
- Description:
- Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
- Reason: Failed to determine suitable jdbc url
- Action:
- Consider the following:
- If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
- If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
- spring.jpa.hibernate.ddl-auto=update
- spring.jpa.generate-ddl=true
- spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL94Dialect
- spring.datasource.driverClassName=org.postgresql.Driver
- spring.datasourse.url=jdbc:postgresql://localhost:5432/personal
- spring.datasourse.username=postgres
- spring.datasourse.pasword=root
- spring.jpa.show-sql=true
- spring.session.store-type=none
- @PostMapping
- public String add(@RequestParam String text,
- @RequestParam String tag, Map<String, Object> model) {
- messageRepo.save(new Message(text, tag));
- Iterable<Message> messages = messageRepo.findAll();
- model.put("messages", messages);
- return "main";
- }
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-mustache</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-devtools</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- <version>2.0.3.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.postgresql</groupId>
- <artifactId>postgresql</artifactId>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- <html>
- <body>
- <div>
- <form method="post">
- <input type="text" name="text" placeholder="Введіть повідомлення" />
- <input type="text" name="tag" placeholder="tag" />
- <button type="submit">Добавити</button>
- </form>
- </div>
- <div>Список повідомлень</div>
- {{#messeges}}
- <div>
- <b>{{id}}</b>
- <span>{{text}}</span>
- <i>{{tag}}</i>
- </div>
- {{/messeges}}
- </body>
- </html>
- @Entity
- public class Message {
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- private Integer id;
- private String text;
- private String tag;
- public Message() {
- }
- public Message(String text, String tag) {
- this.text = text;
- this.tag = tag;
- }
- public Integer getId() {
- return id;
- }
- public void setId(Integer id) {
- this.id = id;
- }
- public String getText() {
- return text;
- }
- public void setText(String text) {
- this.text = text;
- }
- public String getTag() {
- return tag;
- }
- public void setTag(String tag) {
- this.tag = tag;
- }
- }
Add Comment
Please, Sign In to add comment