Skip to content

Commit

Permalink
new files added
Browse files Browse the repository at this point in the history
  • Loading branch information
Han4o committed Dec 14, 2019
1 parent 8b5840b commit bb9de6b
Show file tree
Hide file tree
Showing 41 changed files with 687 additions and 33 deletions.
19 changes: 19 additions & 0 deletions .idea/$PRODUCT_WORKSPACE_FILE$

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 1 addition & 12 deletions .idea/dbnavigator.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions HotDogForum.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />
61 changes: 42 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,58 @@
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>HotDogPro</groupId>
<artifactId>HotDogProject Team1</artifactId>
<groupId>com.example</groupId>
<artifactId>HotDogForum</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<hibernate-version>5.0.1.Final</hibernate-version>
</properties>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
</parent>

<dependencies>
<!--driver for connection to MYSql database -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.34</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate-version}</version>
<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>

<!-- for JPA, use hibernate-entitymanager instead of hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate-version}</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>

<properties>
<java.version>1.8</java.version>
</properties>


<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>
13 changes: 13 additions & 0 deletions src/main/java/com/example/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.example;

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);
}

}
39 changes: 39 additions & 0 deletions src/main/java/com/example/GreetingsController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@Controller
public class GreetingsController {
@Autowired
private InfoRepository infoRepository;
@GetMapping("/")
public String greeting(Map<String, Object> model) {

return "greeting";
}
@GetMapping("/main")
public String main(Map<String, Object> model) {
Iterable<Info> info = infoRepository.findAll();
model.put("info", info);
return "main";
}

@PostMapping("/main")
public String add(@RequestParam String name, @RequestParam String email, Map<String, Object> model)
{
Info info = new Info(name, email);

infoRepository.save(info);

infoRepository.findAll();
model.put("info", info);
return "main";
}

}
Loading

0 comments on commit bb9de6b

Please sign in to comment.