From aae358b2beaa11491b84664c18dbfeb66ae0ce05 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Sun, 26 Oct 2025 19:35:59 +0100 Subject: [PATCH] Add OnlineQuiz app --- OnlineQuiz/build.gradle | 28 +++ .../com/app/quiz/OnlineQuizApplication.java | 13 + .../app/quiz/config/WebSecurityConfig.java | 48 ++++ .../app/quiz/controller/QuizController.java | 222 ++++++++++++++++++ .../java/com/app/quiz/model/Question.java | 75 ++++++ .../main/java/com/app/quiz/model/User.java | 56 +++++ .../app/quiz/service/QuestionsService.java | 69 ++++++ .../quiz/service/QuizUserDetailsService.java | 45 ++++ .../src/main/resources/application.properties | 9 + .../src/main/resources/templates/Quiz.html | 82 +++++++ .../main/resources/templates/QuizList.html | 124 ++++++++++ .../src/main/resources/templates/addQuiz.html | 123 ++++++++++ .../main/resources/templates/editQuiz.html | 125 ++++++++++ .../src/main/resources/templates/login.html | 111 +++++++++ .../main/resources/templates/register.html | 97 ++++++++ .../src/main/resources/templates/result.html | 131 +++++++++++ build.gradle | 8 +- gradlew | 4 +- settings.gradle | 3 +- 19 files changed, 1367 insertions(+), 6 deletions(-) create mode 100644 OnlineQuiz/build.gradle create mode 100644 OnlineQuiz/src/main/java/com/app/quiz/OnlineQuizApplication.java create mode 100644 OnlineQuiz/src/main/java/com/app/quiz/config/WebSecurityConfig.java create mode 100644 OnlineQuiz/src/main/java/com/app/quiz/controller/QuizController.java create mode 100644 OnlineQuiz/src/main/java/com/app/quiz/model/Question.java create mode 100644 OnlineQuiz/src/main/java/com/app/quiz/model/User.java create mode 100644 OnlineQuiz/src/main/java/com/app/quiz/service/QuestionsService.java create mode 100644 OnlineQuiz/src/main/java/com/app/quiz/service/QuizUserDetailsService.java create mode 100644 OnlineQuiz/src/main/resources/application.properties create mode 100644 OnlineQuiz/src/main/resources/templates/Quiz.html create mode 100644 OnlineQuiz/src/main/resources/templates/QuizList.html create mode 100644 OnlineQuiz/src/main/resources/templates/addQuiz.html create mode 100644 OnlineQuiz/src/main/resources/templates/editQuiz.html create mode 100644 OnlineQuiz/src/main/resources/templates/login.html create mode 100644 OnlineQuiz/src/main/resources/templates/register.html create mode 100644 OnlineQuiz/src/main/resources/templates/result.html diff --git a/OnlineQuiz/build.gradle b/OnlineQuiz/build.gradle new file mode 100644 index 0000000..219302d --- /dev/null +++ b/OnlineQuiz/build.gradle @@ -0,0 +1,28 @@ +import org.springframework.boot.gradle.plugin.SpringBootPlugin + +apply plugin: 'java' +apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' + +description = 'Secure Online Quiz Application' + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 +} + +repositories { + mavenCentral() +} + +dependencyManagement { + imports { + mavenBom SpringBootPlugin.BOM_COORDINATES + } +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-security' +} \ No newline at end of file diff --git a/OnlineQuiz/src/main/java/com/app/quiz/OnlineQuizApplication.java b/OnlineQuiz/src/main/java/com/app/quiz/OnlineQuizApplication.java new file mode 100644 index 0000000..5ecc603 --- /dev/null +++ b/OnlineQuiz/src/main/java/com/app/quiz/OnlineQuizApplication.java @@ -0,0 +1,13 @@ +package com.app.quiz; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class OnlineQuizApplication { + + public static void main(String[] args) { + SpringApplication.run(OnlineQuizApplication.class, args); + } + +} \ No newline at end of file diff --git a/OnlineQuiz/src/main/java/com/app/quiz/config/WebSecurityConfig.java b/OnlineQuiz/src/main/java/com/app/quiz/config/WebSecurityConfig.java new file mode 100644 index 0000000..f75922f --- /dev/null +++ b/OnlineQuiz/src/main/java/com/app/quiz/config/WebSecurityConfig.java @@ -0,0 +1,48 @@ +package com.app.quiz.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.config.Customizer; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer; + +@Configuration +@EnableWebSecurity +public class WebSecurityConfig { + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http.authorizeHttpRequests(request -> request + .requestMatchers("/login","/register").permitAll() + .requestMatchers("/home").hasAnyRole("USER", "ADMIN") + .anyRequest().authenticated() + ) + .formLogin(form -> form + .loginPage("/login").permitAll() + .defaultSuccessUrl("/home") + ) + .logout(Customizer.withDefaults()); + + return http.build(); + } + + @Bean + public AuthenticationManager authenticationManager() { + return authentication -> + new UsernamePasswordAuthenticationToken(authentication.getPrincipal(), authentication.getCredentials()); + } + +} \ No newline at end of file diff --git a/OnlineQuiz/src/main/java/com/app/quiz/controller/QuizController.java b/OnlineQuiz/src/main/java/com/app/quiz/controller/QuizController.java new file mode 100644 index 0000000..ec3bc18 --- /dev/null +++ b/OnlineQuiz/src/main/java/com/app/quiz/controller/QuizController.java @@ -0,0 +1,222 @@ +package com.app.quiz.controller; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.WebAuthenticationDetails; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.ui.Model; +import org.springframework.security.core.Authentication; +import com.app.quiz.service.QuizUserDetailsService; +import com.app.quiz.model.Question; +import com.app.quiz.service.QuestionsService; + +@Controller +public class QuizController { + + private final QuizUserDetailsService userDetailsService; + private final QuestionsService questionsService; + private final AuthenticationManager authenticationManager; + + public QuizController(QuizUserDetailsService userDetailsService, AuthenticationManager authenticationManager, QuestionsService questionsService) { + this.userDetailsService = userDetailsService; + this.authenticationManager = authenticationManager; + this.questionsService = questionsService; + } + + @GetMapping("/home") + public String homepage(Model model) { + // Get the authenticated user's details + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + + // Get the username + String username = authentication.getName(); + model.addAttribute("username", username); + + // Get the user's role + String role = authentication.getAuthorities().stream() + .map(GrantedAuthority::getAuthority) + .findFirst() + .orElse("ROLE_USER"); // Default role if no authority is found + + // Redirect to the appropriate page based on the role + if (role.equals("ROLE_ADMIN")) { + // Fetch the latest quizzes from the service + List quizzes = questionsService.loadQuizzes(); + + // Add the quizzes to the model + model.addAttribute("quizzes", quizzes); + return "QuizList"; // Return the QuizList.html template + } else { + // Fetch the latest quizzes from the service + List quizzes = questionsService.loadQuizzes(); + + // Add the quizzes to the model + model.addAttribute("quizzes", quizzes); + return "Quiz"; // Return the Quiz.html template + } + } + + @GetMapping("/login") + public String login() { + return "login"; // Returns the login.html template + } + + @GetMapping("/register") + public String register() { + return "register"; // Returns the register.html template + } + + // POST endpoint to handle user registration and auto-login + @PostMapping("/register") + public String registerUser( + @RequestParam String username, // Username from the form + @RequestParam String password, // Password from the form + @RequestParam String email, // Email from the form + @RequestParam String role, // Role from the form, + HttpServletRequest request + ) { + // Register the user by storing their details in the HashMap + try { + userDetailsService.registerUser(username, password, email, role); + } catch (Exception userExistsAlready) { + // Redirect to the /register endpoint + return "redirect:/register?error"; + } + + // Authenticate the user + UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(username, password); + authToken.setDetails(new WebAuthenticationDetails(request)); + Authentication authentication = authenticationManager.authenticate(authToken); + SecurityContextHolder.getContext().setAuthentication(authentication); + + // Redirect to the /login endpoint + return "redirect:/login?success"; + } + + @GetMapping("/addQuiz") + public String showAddQuizForm(Model model) { + model.addAttribute("quiz", new Question()); // Add a new Quiz object to the model + return "addQuiz"; // Return the addQuiz.html template + } + @PostMapping("/addQuiz") + public String addQuiz(@ModelAttribute Question quiz, Model model, Authentication authentication) { + // Get the user's role + String role = authentication.getAuthorities().stream() + .map(GrantedAuthority::getAuthority) + .findFirst() + .orElse("ROLE_USER"); // Default role if no authority is found + + // Redirect to the appropriate page based on the role + if (role.equals("ROLE_ADMIN")) { + quiz.setId(questionsService.getNextId()); + // Add the quiz to the service + questionsService.addQuestion(quiz); + + // Add a success message to the model + model.addAttribute("success", "Quiz added successfully!"); + + // Redirect to the quiz list page + return "redirect:/home"; + } else { + // Add an error message to the model + model.addAttribute("error", "You do not have permission to add a quiz."); + + // Redirect to the add quiz page + return "redirect:/addQuiz?error"; + } + } + + // Display the edit quiz page + @GetMapping("/editQuiz/{id}") + public String showEditQuizForm(@PathVariable("id") int id, Model model) { + // Find the quiz by ID + Question quiz = questionsService.getQuestionById(id); + + // Add the quiz to the model + model.addAttribute("quiz", quiz); + + // Return the editQuiz.html template + return "editQuiz"; + } + + @PostMapping("/editQuestion") + public String editQuestion(@ModelAttribute("quiz") Question quiz) { + // Get the authenticated user's details + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + + // Get the user's role + String role = authentication.getAuthorities().stream() + .map(GrantedAuthority::getAuthority) + .findFirst() + .orElse("ROLE_USER"); // Default role if no authority is found + + // Redirect to the appropriate page based on the role + if (role.equals("ROLE_ADMIN")) { + // Update the quiz in the service + questionsService.editQuestion(quiz); + // Redirect to the quiz list page + return "redirect:/home"; + } else { + // Redirect to the quiz page + return "redirect:/home"; + } + } + + @GetMapping("/deleteQuiz/{id}") + public String deleteQuiz(@PathVariable("id") int id, Model model) { + // Get the authenticated user's details + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + + // Get the user's role + String role = authentication.getAuthorities().stream() + .map(GrantedAuthority::getAuthority) + .findFirst() + .orElse("ROLE_USER"); // Default role if no authority is found + + // Redirect to the appropriate page based on the role + if (role.equals("ROLE_ADMIN")) { + // Delete the quiz by ID + questionsService.deleteQuestion(id); + return "redirect:/home"; // Redirect to the quiz list page + } else { + return "redirect:/home"; // Redirect to the home page + } + } + @PostMapping("/submitQuiz") + public String evaluateQuiz(@RequestParam Map allParams, Model model) { + int correctAnswers = 0; + List userAnswers = new ArrayList<>(); + List quizzes = questionsService.loadQuizzes(); + + // Iterate through the quizzes and compare answers + for (int i = 0; i < quizzes.size(); i++) { + String userAnswer = allParams.get("answer" + i); // Get the answer for question i + userAnswers.add(userAnswer); // Store user's answer + if (quizzes.get(i).getCorrectAnswer().equals(userAnswer)) { + correctAnswers++; + } + } + + // Add data to the model + model.addAttribute("quizzes", quizzes); + model.addAttribute("userAnswers", userAnswers); + model.addAttribute("correctAnswers", correctAnswers); + model.addAttribute("totalQuestions", quizzes.size()); + + // Return the result template + return "result"; + } +} \ No newline at end of file diff --git a/OnlineQuiz/src/main/java/com/app/quiz/model/Question.java b/OnlineQuiz/src/main/java/com/app/quiz/model/Question.java new file mode 100644 index 0000000..454c40b --- /dev/null +++ b/OnlineQuiz/src/main/java/com/app/quiz/model/Question.java @@ -0,0 +1,75 @@ +package com.app.quiz.model; + +import java.util.ArrayList; +import java.util.Arrays; + +public class Question { + private Integer id; + private String questionText; + private ArrayList options; // Keep options as ArrayList + private String correctAnswer; + + // No-argument constructor (required for Thymeleaf binding) + public Question() { + this.options = new ArrayList<>(); + } + + // Constructor with parameters + public Question(Integer id, String questionText, ArrayList options, String correctAnswer) { + this.id = id; + this.questionText = questionText; + this.options = options; + this.correctAnswer = correctAnswer; + } + + // Getters and Setters + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getQuestionText() { + return questionText; + } + + public void setQuestionText(String questionText) { + this.questionText = questionText; + } + + public ArrayList getOptions() { + return options; + } + + public void setOptions(ArrayList options) { + this.options = options; + } + + // Helper method to get options as a comma-separated string + public String getOptionsAsString() { + return String.join(",", options); + } + + // Helper method to set options from a comma-separated string + public void setOptionsFromString(String optionsString) { + this.options = new ArrayList<>(Arrays.asList(optionsString.split(","))); + } + + public String getCorrectAnswer() { + return correctAnswer; + } + + public void setCorrectAnswer(String correctAnswer) { + this.correctAnswer = correctAnswer; + } + + @Override + public String toString() { + return ("ID: " + id + + "\nQuestion: " + questionText + + "\nOptions: " + options + + "\nCorrect Answer: " + correctAnswer); + } +} \ No newline at end of file diff --git a/OnlineQuiz/src/main/java/com/app/quiz/model/User.java b/OnlineQuiz/src/main/java/com/app/quiz/model/User.java new file mode 100644 index 0000000..6fc137d --- /dev/null +++ b/OnlineQuiz/src/main/java/com/app/quiz/model/User.java @@ -0,0 +1,56 @@ +package com.app.quiz.model; + +public class User { + private String username; + private String email; + private String password; + private String role; + + public User(String username, String email, String password, String role) { + this.username = username; + this.email = email; + this.password = password; + this.role = role; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + @Override + public String toString() { + return "User{" + + "username='" + username + '\'' + + ", email='" + email + '\'' + + ", role='" + role + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/OnlineQuiz/src/main/java/com/app/quiz/service/QuestionsService.java b/OnlineQuiz/src/main/java/com/app/quiz/service/QuestionsService.java new file mode 100644 index 0000000..64a9eb0 --- /dev/null +++ b/OnlineQuiz/src/main/java/com/app/quiz/service/QuestionsService.java @@ -0,0 +1,69 @@ +package com.app.quiz.service; + +import java.util.*; + +import org.springframework.stereotype.Service; + +import com.app.quiz.model.Question; + +@Service +public class QuestionsService { + + private final Map questions = new HashMap<>(); + private int nextId = 1; + + public List loadQuizzes() { + return List.copyOf(questions.values()); + } + + public Question getQuestionById(int id) { + return questions.get(id); + } + + public int getNextId() { + return nextId++; + } + + public boolean addQuestion(Question Question) { + Integer QuestionId = Question.getId(); + + if (questions.containsKey(QuestionId)) { + return false; + } else { + questions.put(QuestionId, Question); + return true; + } + } + + public boolean editQuestion(Question Question) { + Integer QuestionId = Question.getId(); + + if (questions.containsKey(QuestionId)) { + questions.put(QuestionId, Question); + return true; + } else { + return false; + } + } + + public boolean deleteQuestion(int id) { + Integer QuestionId = Integer.valueOf(id); + if (questions.containsKey(QuestionId)) { + questions.remove(QuestionId); + return true; + } else { + return false; + } + } + + public int submitQuestion(ArrayList list) { + int result = 0; + for (Question Question: list){ + Question QuestionInList = questions.get(Question.getId()); + if(QuestionInList.getCorrectAnswer().equals(Question.getCorrectAnswer())) { + result++; + } + } + return result; + } +} \ No newline at end of file diff --git a/OnlineQuiz/src/main/java/com/app/quiz/service/QuizUserDetailsService.java b/OnlineQuiz/src/main/java/com/app/quiz/service/QuizUserDetailsService.java new file mode 100644 index 0000000..c363987 --- /dev/null +++ b/OnlineQuiz/src/main/java/com/app/quiz/service/QuizUserDetailsService.java @@ -0,0 +1,45 @@ +package com.app.quiz.service; + +import com.app.quiz.model.User; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +@Service +public class QuizUserDetailsService implements UserDetailsService { + + private final List users = new ArrayList<>(); + private final PasswordEncoder passwordEncoder; + + public QuizUserDetailsService(PasswordEncoder passwordEncoder) { + this.passwordEncoder = passwordEncoder; + } + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { + Optional user = users.stream().filter(u -> u.getUsername().equals(username)).findFirst(); + if (user.isEmpty()) { + throw new UsernameNotFoundException("User %s not found".formatted(username)); + } + return org.springframework.security.core.userdetails.User + .withUsername(user.get().getUsername()) + .password(user.get().getPassword()) + .roles(user.get().getRole()) + .build(); + } + + public void registerUser(String username, String password, String email, String role) { + if (users.stream().anyMatch(u -> u.getUsername().equals(username))) { + throw new BadCredentialsException("Username already exists"); + } + users.add(new User(username, email, passwordEncoder.encode(password), role)); + } + +} \ No newline at end of file diff --git a/OnlineQuiz/src/main/resources/application.properties b/OnlineQuiz/src/main/resources/application.properties new file mode 100644 index 0000000..815ee0c --- /dev/null +++ b/OnlineQuiz/src/main/resources/application.properties @@ -0,0 +1,9 @@ +spring.application.name=Online Quiz + +# Server port +server.port=8080 + +# Thymeleaf configuration +spring.thymeleaf.cache=false +spring.thymeleaf.prefix=classpath:/templates/ +spring.thymeleaf.suffix=.html \ No newline at end of file diff --git a/OnlineQuiz/src/main/resources/templates/Quiz.html b/OnlineQuiz/src/main/resources/templates/Quiz.html new file mode 100644 index 0000000..e09ea07 --- /dev/null +++ b/OnlineQuiz/src/main/resources/templates/Quiz.html @@ -0,0 +1,82 @@ + + + + + Quiz + + + + +
+

Quiz Questions

+
+ +
+
+
+
+
+
+
    +
  • + + +
  • +
+
+
+ +
+ + \ No newline at end of file diff --git a/OnlineQuiz/src/main/resources/templates/QuizList.html b/OnlineQuiz/src/main/resources/templates/QuizList.html new file mode 100644 index 0000000..fb0b587 --- /dev/null +++ b/OnlineQuiz/src/main/resources/templates/QuizList.html @@ -0,0 +1,124 @@ + + + + + Quiz List + + + + +
+

Quiz Questions

+
+ +
+
+ + + + + +
+
+
+
+
    +
  • +
+
+
+ + + + + + + + +
+
+ + \ No newline at end of file diff --git a/OnlineQuiz/src/main/resources/templates/addQuiz.html b/OnlineQuiz/src/main/resources/templates/addQuiz.html new file mode 100644 index 0000000..bea8f95 --- /dev/null +++ b/OnlineQuiz/src/main/resources/templates/addQuiz.html @@ -0,0 +1,123 @@ + + + + + Add Quiz + + + +
+ +
Add a New Quiz
+ + +
+ +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + + +
+
+ + \ No newline at end of file diff --git a/OnlineQuiz/src/main/resources/templates/editQuiz.html b/OnlineQuiz/src/main/resources/templates/editQuiz.html new file mode 100644 index 0000000..826b8df --- /dev/null +++ b/OnlineQuiz/src/main/resources/templates/editQuiz.html @@ -0,0 +1,125 @@ + + + + + Edit Quiz + + + +
+ +
Edit Quiz
+ + +
+ + + + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + + +
+
+ + \ No newline at end of file diff --git a/OnlineQuiz/src/main/resources/templates/login.html b/OnlineQuiz/src/main/resources/templates/login.html new file mode 100644 index 0000000..3e4058b --- /dev/null +++ b/OnlineQuiz/src/main/resources/templates/login.html @@ -0,0 +1,111 @@ + + + + + + Login Page + + + + + + \ No newline at end of file diff --git a/OnlineQuiz/src/main/resources/templates/register.html b/OnlineQuiz/src/main/resources/templates/register.html new file mode 100644 index 0000000..9f3534c --- /dev/null +++ b/OnlineQuiz/src/main/resources/templates/register.html @@ -0,0 +1,97 @@ + + + + + + Registration Page + + + +
+

Register

+
+ + + + + + + + + + + + + + +
+ +
+ Invalid username. +
+ +

Already have an account? Login here

+
+ + \ No newline at end of file diff --git a/OnlineQuiz/src/main/resources/templates/result.html b/OnlineQuiz/src/main/resources/templates/result.html new file mode 100644 index 0000000..5d11e9f --- /dev/null +++ b/OnlineQuiz/src/main/resources/templates/result.html @@ -0,0 +1,131 @@ + + + + + Quiz Result + + + + +
+ + + +
+ +
+
+ + +
+ +
+ + +
+

Details:

+
    + +
  • +
    + +
    +
    + Your Answer: + +
    +
    + Correct Answer: + +
    +
  • +
+
+
+ + \ No newline at end of file diff --git a/build.gradle b/build.gradle index f657ee9..2b0ac0d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,9 @@ +plugins { + id 'org.springframework.boot' version '3.5.7' apply false + id 'io.spring.dependency-management' version '1.1.7' apply false +} + allprojects { group = 'me.ahlroos' version = '1.0-SNAPSHOT' - repositories { - mavenCentral() - } } \ No newline at end of file diff --git a/gradlew b/gradlew index 23d15a9..9132f57 100755 --- a/gradlew +++ b/gradlew @@ -45,7 +45,7 @@ # by Bash, Ksh, etc; in particular arrays are avoided. # # The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security +# space-separated string is a well documented source of bugs and config # problems, so this is (mostly) avoided, by progressively accumulating # options in "$@", and eventually passing that to Java. # @@ -248,4 +248,4 @@ eval "set -- $( tr '\n' ' ' )" '"$@"' -exec "$JAVACMD" "$@" +exec "$JAVACMD" "$@" \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index b591a8c..6b10282 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,4 @@ rootProject.name = 'java-developer-course' include 'PetCareScheduler' -include 'Portfolio' \ No newline at end of file +include 'Portfolio' +include 'OnlineQuiz' \ No newline at end of file