Commit 4376dade authored by dbhuller's avatar dbhuller

basic spring boot application from course up and running

parent 61b0443d
package com.example.fundamentals.service;
import com.example.fundamentals.entity.Application;
public interface ApplicationService {
Iterable<Application> listApplications();
}
package com.example.fundamentals.service;
import com.example.fundamentals.entity.Application;
import com.example.fundamentals.repository.ApplicationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ApplicationServiceImpl implements ApplicationService {
@Autowired
private ApplicationRepository applicationRepository;
@Override
public Iterable<Application> listApplications() {
return applicationRepository.findAll();
}
}
package com.example.fundamentals.service;
import com.example.fundamentals.entity.Release;
public interface ReleaseService {
Iterable<Release> listReleases();
}
package com.example.fundamentals.service;
import com.example.fundamentals.entity.Release;
import com.example.fundamentals.repository.ReleaseRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ReleaseServiceImpl implements ReleaseService {
@Autowired
ReleaseRepository releaseRepository;
@Override
public Iterable<Release> listReleases() {
return releaseRepository.findAll();
}
}
package com.example.fundamentals.service;
import com.example.fundamentals.entity.Ticket;
public interface TicketService {
Iterable<Ticket> listTickets();
}
package com.example.fundamentals.service;
import com.example.fundamentals.entity.Ticket;
import com.example.fundamentals.repository.TicketRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class TicketServiceImpl implements TicketService {
@Autowired
TicketRepository ticketRepository;
@Override
public Iterable<Ticket> listTickets() {
return ticketRepository.findAll();
}
}
package com.example.fundamentals.web;
import com.example.fundamentals.service.ApplicationService;
import com.example.fundamentals.service.ReleaseService;
import com.example.fundamentals.service.TicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class TzaController {
private ApplicationService applicationService;
private TicketService ticketService;
private ReleaseService releaseService;
@Autowired
public void setApplicationService(ApplicationService applicationService) {
this.applicationService = applicationService;
}
@Autowired
public void setTicketService(TicketService ticketService) {
this.ticketService = ticketService;
}
@Autowired
public void setReleaseService(ReleaseService releaseService) {
this.releaseService = releaseService;
}
@GetMapping("/applications")
public String getApplications(Model model) {
model.addAttribute("applications", applicationService.listApplications());
return "applications";
}
@GetMapping("/tickets")
public String getTickets(Model model) {
model.addAttribute("tickets", ticketService.listTickets());
return "tickets";
}
@GetMapping("/releases")
public String getReleases(Model model) {
model.addAttribute("releases", releaseService.listReleases());
return "releases";
}
}
logging.level.org.springframework: DEBUG logging.level.org.springframework: DEBUG
# H2
spring.h2.console.enabled=true
spring.h2.console.path=/h2
spring.datasource.url=jdbc:h2:mem:bugtracker
# ThymeLeaf
spring.thymeleaf.template-loader-path: classpath:/templates
spring.thymeleaf.suffix: .html
spring.thymeleaf.cache: false
INSERT INTO application (application_id, app_name, description, owner) VALUES (1, 'Trackzilla','A bug tracking application', 'Kesha Williams');
INSERT INTO application (application_id, app_name, description, owner) VALUES (2, 'Expenses','An application used to submit expenses', 'Jane Doe');
INSERT INTO application (application_id, app_name, description, owner) VALUES (3, 'Bookings','An application used to book tickets', 'John Doe');
INSERT INTO application (application_id, app_name, description, owner) VALUES (4, 'Invoice Search','An application used to search invoices ', 'Mary Richards');
INSERT INTO application (application_id, app_name, description, owner) VALUES (5, 'Audits','An application used for auditing purposes.', 'Tiffany Stewart');
INSERT INTO ticket (id, title, description, application_id, status) VALUES (1, 'Sort Feature','Add the ability to sort tickets by severity',1,'OPEN');
INSERT INTO ticket (id, title, description, application_id, status) VALUES (2, 'Search Feature','Add the ability to search by invoice date',4,'IN PROGRESS');
INSERT INTO ticket (id, title, description, application_id, status) VALUES (3, 'Audit','Add the ability to audit by year',5,'CLOSED');
INSERT INTO ticket (id, title, description, application_id, status) VALUES (4, 'Booking Feature','Add the ability to book tickets online',3,'OPEN');
INSERT INTO release (id, description, release_date) VALUES (1,'Q1 Release Containing High Priority Bugs', '2030-02-14');
INSERT INTO release (id, description, release_date) VALUES (2,'Q2 Release Containing High Priority Enhancements', '2030-05-27');
INSERT INTO release (id, description, release_date) VALUES (3,'Q3 Release Containing Bugs', '2030-09-14');
INSERT INTO release (id, description, release_date) VALUES (4,'Q4 Release Containing Enhancements', '2030-12-10');
INSERT INTO ticket_release (release_fk, ticket_fk) VALUES (1,3);
INSERT INTO ticket_release (release_fk, ticket_fk) VALUES (2,1);
INSERT INTO ticket_release (release_fk, ticket_fk) VALUES (2,4);
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Trackzilla Applications</title>
</head>
<body>
<div class="container">
<div th:insert="fragments/navbar.html"> </div>
<div class="jumbotron">
<h3>Applications</h3>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Description</th>
<th scope="col">Owner</th>
</tr>
</thead>
<tbody>
<tr th:each="item : ${applications}">
<td th:text="${item.id}"></td>
<td th:text="${item.name}"></td>
<td th:text="${item.description}"></td>
<td th:text="${item.owner}"></td>
</tr>
</tbody>
</table>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="/">Trackzilla Menu</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarAppMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Applications
</a>
<div class="dropdown-menu" aria-labelledby="navbarAppMenuLink">
<a class="dropdown-item" href="/applications">View</a>
<a class="dropdown-item" href="/applications/new">Create</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarTcktMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Tickets
</a>
<div class="dropdown-menu" aria-labelledby="navbarTcktMenuLink">
<a class="dropdown-item" href="/tickets">View</a>
<a class="dropdown-item" href="/tickets/new">Create</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarRelMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Releases
</a>
<div class="dropdown-menu" aria-labelledby="navbarRelMenuLink">
<a class="dropdown-item" href="/releases">View</a>
<a class="dropdown-item" href="/releases/new">Create</a>
</div>
</li>
</ul>
<!-- <form class="form-inline my-2 my-lg-0">-->
<!-- <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">-->
<!-- <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>-->
<!-- </form>-->
</div>
</nav>
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Pluralsight - Spring Fundamentals</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div th:insert="fragments/navbar.html"> </div>
<div class="jumbotron">
<div class="row text-center">
<div class="">
<h3>Defect and Enhancement Tracking</h3>
<p>
The demonstration vehicle for this course will be based on a use case from Keysoft Inc., a fictitious company, that needs to quickly develop an application to help manage bug fixes and enhancement requests for their applications. Keysoft’s engineering team has decided to utilize Spring Boot to make development faster and deployment easier with minimal boilerplate code and configuration. During the course, you walk through the use case of creating the bug tracking application, Trackzilla, using Spring Boot.
</p>
<img src="/images/virus.png" style="width:25%" />
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Trackzilla Releases</title>
</head>
<body>
<div class="container">
<div th:insert="fragments/navbar.html"> </div>
<div class="jumbotron">
<h3>Releases</h3>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
<th scope="col">Release Date</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr th:each="item : ${releases}">
<td th:text="${item.id}"></td>
<td th:text="${item.releaseDate}"></td>
<td th:text="${item.description}"></td>
</tr>
</tbody>
</table>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Trackzilla Applications</title>
</head>
<body>
<div class="container">
<div th:insert="fragments/navbar.html"> </div>
<div class="jumbotron">
<h3>Tickets</h3>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
<th scope="col">Title</th>
<th scope="col">Description</th>
<th scope="col">Application</th>
<th scope="col">Release Date</th>
</tr>
</thead>
<tbody>
<tr th:each="item : ${tickets}">
<td th:text="${item.id}"></td>
<td th:text="${item.title}"></td>
<td th:text="${item.description}"></td>
<td th:text="${item.application.name}"></td>
<td th:text="${item?.release?.releaseDate}"></td>
</tr>
</tbody>
</table>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment