This post will help you successfully run Module2.1 project on Eclipse for CS-305: Software Security.
In module 2, you are asked to conduct a code review and mitigation plan for a web application that uses the Spring Framework. You are given the codebase and to upload it to Eclipse for manual review.
Download Java SE Development Kit 12.0.2
Follow the instruction by first downloading Java SE Development Kit 12.0.2 from Oracle’s website. Here is a direct link for this specific version: https://www.oracle.com/java/technologies/javase/jdk12-archive-downloads.html#
Upload the codebase to Eclipse
After downloading Java SE Development Kit 12.0.2 and uploading the codebase to Eclipse, run the application as “Java Application.” After you run the application, you might get an error such as the following:
APPLICATION FAILED TO START
The bean 'httpRequestHandlerAdapter', defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class] and overriding is disabled.
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
How to Fix the Error for Project Module2.1 in Eclipse
First, open pom.xml and navigate to the pom.xml file.
Under dependencies, look for this dependency:
If you hover over the exclamation mark, it should read as follows:
Overriding managed version 3.2.4.RELEASE for spring-data-rest-webmvc.
To fix the error for project Module2.1, simply replace
3.2.4.RELEASE or whatever version Eclipse is telling you and save the changes you made.
After following the above steps, I was able to successfully launch the application. This is the success message I got:
Take note of the port number being used, mine was port 8080.
Tomcat initialized with port(s): 8080 (http)
Now you can access the webpage by opening your browsing and going to http://localhost:8080/
Don’t forget to mention upgrading
org.springframework.data as part of your mitigation plan.