A wine crud made using Spring Boot. This my project for the AlgaWorks's Spring Boot course.
- Create, read and update of wine
- Login with hard-coded users and roles
- Wine image upload and storage with s3Ninja
- Setup your environment for Spring Framework and to open this project.
- Install the Maven dependencies.
- Install MySQL
- Setup your MySQL to create your user and database.
- In the project, change the
src/main/resources/application.properties
file to match your MySQL credentials and database URL. - (Optional) Go to
src/main/java/com/algaworks/vinho/config/SecurityConfig.java
to view the hard coded users and/or add your own user and their role(s):- Available roles:
LISTAR_VINHO
(permission to read) andCADASTRAR_VINHO
(permission to create/update).
- Available roles:
// ...
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("USERNAME_HERE").password("{noop}PASSWORD_HERE").roles("CADASTRAR_VINHO", "LISTAR_VINHO");
}
// ...
- Download s3Ninja (project developed with s3Ninja version 2.7).
- Start s3Ninja by navigating to its folder and running the
IPL.class
file:java IPL
. - (Likely to not be needed) In the project, go to the
src/main/java/com/algaworks/vinho/config/AmazonConfig.java
and change the credentials to match the one specified by s3Ninja (displayed at http://localhost:9444).
// ...
AWSCredentials credentials = new BasicAWSCredentials("ACCESS KEY HERE", "SECRET KEY HERE");
// ...
- Build and run the project. By accessing http://localhost:8080, you should be redirected to the
/login
page.
PS: Flyway should create the necessary table automatically when you run the project. If not, use the SQL scripts located at
src/main/resources/db.migration
.
leluque for assigning me this project's course.