FIX:: fixed Client application class
The class was not seeing some imports from the same package, and some getters and setters for User.java were not written, so I wrote those and fixed the imports FIX:: fixed packages Everything now isn't in several subpackages in the Client, Common and Server package anymore, but straight in their respectable packages. Also fixed the package names BUG FIX: fixed Client Application class not being able to see GetBean method Don't really know how it got fixed, but resolving the import issues also fixed this bug. EDIT::changed main class in build.gradle file to Client.Application --------------- I now only get a bug where the fxmlloader can't see the fxml files, and thus I can't start the application. I get the error message "location not set" although I used fxmlloader.setLocation.
This commit is contained in:
@@ -79,5 +79,5 @@ jacocoTestReport {
|
||||
}
|
||||
|
||||
bootJar {
|
||||
mainClassName = 'GUI.LoginController'
|
||||
mainClassName = 'Client.Application'
|
||||
}
|
||||
|
||||
BIN
classes/production/OOPP/META-INF/OOPP.kotlin_module
Normal file
BIN
classes/production/OOPP/META-INF/OOPP.kotlin_module
Normal file
Binary file not shown.
@@ -1,8 +0,0 @@
|
||||
package gogreen.server.data.repository;
|
||||
|
||||
import gogreen.server.data.model.User;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface UserJpaRepository extends gogreen.server.data.repository.UserRepository, JpaRepository<User,Long> {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package Client.main.java.gogreen.client;
|
||||
package Client;
|
||||
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
@@ -6,14 +6,10 @@ import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import static org.springframework.boot.SpringApplication.*;
|
||||
|
||||
import static org.springframework.boot.SpringApplication.run;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Application extends javafx.application.Application {
|
||||
@@ -40,8 +36,11 @@ public class Application extends javafx.application.Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception{
|
||||
fxmlLoader.setLocation(this.getClass().getClassLoader().getResource("fxml/sample.fxml"));
|
||||
rootNode = fxmlLoader.load();
|
||||
fxmlLoader.setLocation(this.getClass().getClassLoader().getResource("main/Client/fxml/sample.fxml"));
|
||||
// fxmlLoader.setLocation(Client.Application.class.getResource("resources/fxml/sample.fxml"));
|
||||
Parent rootNode = fxmlLoader.load();
|
||||
// Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("sample.fxml"));
|
||||
// Image image = new Image("pinkleaf.png");
|
||||
|
||||
// rootNode = FXMLLoader.load(this.getClass().getClassLoader().getResource("fxml/sample.fxml"));
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
package gogreen.client.controller;
|
||||
package Client.controller;
|
||||
|
||||
import gogreen.client.rest.UserService;
|
||||
import Client.rest.UserService;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.Window;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -10,7 +10,7 @@
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<AnchorPane fx:controller="gogreen.client.controller.UserController" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="574.0" prefWidth="934.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<AnchorPane fx:controller="Client.controller.UserController" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="574.0" prefWidth="934.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<ImageView fitHeight="574.0" fitWidth="943.0" layoutX="-1.0" pickOnBounds="true">
|
||||
<image>
|
||||
|
Before Width: | Height: | Size: 247 KiB After Width: | Height: | Size: 247 KiB |
@@ -1,6 +1,6 @@
|
||||
package gogreen.client.rest;
|
||||
package Client.rest;
|
||||
|
||||
import gogreen.common.UserDTO;
|
||||
import Common.UserDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -1,3 +1,5 @@
|
||||
package Client.test.java;
|
||||
|
||||
//import gogreen.client.rest.UserService;
|
||||
//import gogreen.common.UserDTO;
|
||||
//import org.junit.Assert;
|
||||
@@ -1,4 +1,4 @@
|
||||
package gogreen.common;
|
||||
package Common;
|
||||
|
||||
public class ApplicationException extends RuntimeException {
|
||||
public ApplicationException(String message) {
|
||||
@@ -1,4 +1,4 @@
|
||||
package gogreen.common;
|
||||
package Common;
|
||||
|
||||
public class ErrorResponse {
|
||||
String message;
|
||||
@@ -1,4 +1,4 @@
|
||||
package gogreen.common;
|
||||
package Common;
|
||||
|
||||
public class UserDTO {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package gogreen.server;
|
||||
package Server;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -0,0 +1,8 @@
|
||||
package Server.data.gogreen.repository;
|
||||
|
||||
import Server.data.model.User;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface UserJpaRepository extends Server.data.gogreen.repository.UserRepository, JpaRepository<User,Long> {
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package gogreen.server.data.repository;
|
||||
package Server.data.gogreen.repository;
|
||||
|
||||
import gogreen.server.data.model.User;
|
||||
import Server.data.model.User;
|
||||
|
||||
public interface UserRepository {
|
||||
User findByName(String name);
|
||||
@@ -1,4 +1,4 @@
|
||||
package gogreen.server.data.model;
|
||||
package Server.data.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -19,4 +19,22 @@ public class User {
|
||||
Long id;
|
||||
String name;
|
||||
String password;
|
||||
|
||||
public User(Long id, String name, String password) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package gogreen.server.rest;
|
||||
package Server.rest;
|
||||
|
||||
import gogreen.common.ApplicationException;
|
||||
import gogreen.common.ErrorResponse;
|
||||
import Common.ApplicationException;
|
||||
import Common.ErrorResponse;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
@@ -1,7 +1,7 @@
|
||||
package gogreen.server.rest;
|
||||
package Server.rest;
|
||||
|
||||
import gogreen.common.UserDTO;
|
||||
import gogreen.server.service.UserService;
|
||||
import Common.UserDTO;
|
||||
import Server.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -1,9 +1,9 @@
|
||||
package gogreen.server.service;
|
||||
package Server.service;
|
||||
|
||||
import gogreen.common.ApplicationException;
|
||||
import gogreen.common.UserDTO;
|
||||
import gogreen.server.data.model.User;
|
||||
import gogreen.server.data.repository.UserRepository;
|
||||
import Common.ApplicationException;
|
||||
import Common.UserDTO;
|
||||
import Server.data.model.User;
|
||||
import Server.data.gogreen.repository.UserRepository;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -1,7 +1,11 @@
|
||||
package gogreen.server.rest;
|
||||
package Server.test.rest;
|
||||
|
||||
import gogreen.common.UserDTO;
|
||||
import gogreen.server.Application;
|
||||
import Common.UserDTO;
|
||||
|
||||
import Server.Application;
|
||||
//import Client.Application;
|
||||
|
||||
////////////
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
Reference in New Issue
Block a user