Commit b7d38622 authored by Hallvard Trætteberg's avatar Hallvard Trætteberg
Browse files

Fixed use of module-info

Added requires and opens to module-info.
Added --add-opens to surefire in pom.
parent 38783768
......@@ -45,8 +45,6 @@ public class TodoListController {
return todoList;
}
ContextMenu cm;
/**
* Sets the TodoList managed by this controller.
* The corresponding views will be updated.
......
......@@ -162,8 +162,6 @@
<module>fxui</module>
<module>rest</module>
<module>integrationtests</module>
<!--
<module>springboot/restserver</module>
-->
</modules>
</project>
......@@ -92,6 +92,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
@{jaCoCoArgLine} --add-opens todolist.springboot.rest/todolist.springboot.restserver=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
<!-- Run the checkstyle code quality tool -->
<plugin>
......@@ -109,7 +114,10 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<configuration>
<propertyName>jaCoCoArgLine</propertyName>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
......
......@@ -4,7 +4,10 @@ module todolist.springboot.rest {
requires spring.web;
requires spring.beans;
requires spring.boot;
requires spring.context;
requires spring.boot.autoconfigure;
requires todolist.core;
opens todolist.springboot.restserver to spring.beans, spring.context, spring.web;
}
......@@ -4,10 +4,11 @@ import com.fasterxml.jackson.databind.Module;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import todolist.json.TodoPersistence;
import todolist.json.internal.TodoModule;
/**
* The Spring application.
*/
@SpringBootApplication
public class TodoModelApplication {
......
......@@ -13,6 +13,10 @@ import org.springframework.web.bind.annotation.RestController;
import todolist.core.AbstractTodoList;
import todolist.core.TodoModel;
/**
* The service implementation.
*/
@RestController
@RequestMapping(TodoModelController.TODO_MODEL_SERVICE_PATH)
public class TodoModelController {
......
......@@ -10,12 +10,22 @@ import todolist.core.TodoList;
import todolist.core.TodoModel;
import todolist.json.TodoPersistence;
/**
* Configures the todo service,
* including autowired objects.
*/
@Service
public class TodoModelService {
private TodoModel todoModel;
private TodoPersistence todoPersistence;
/**
* Initializes the service with a specific TodoModel.
*
* @param todoModel the TodoModel
*/
public TodoModelService(TodoModel todoModel) {
this.todoModel = todoModel;
this.todoPersistence = new TodoPersistence();
......@@ -51,6 +61,10 @@ public class TodoModelService {
return todoModel;
}
/**
* Saves the TodoModel to disk.
* Should be called after each update.
*/
public void autoSaveTodoModel() {
if (todoPersistence != null) {
try {
......
Supports Markdown
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