JtProject
directoryapplication.properties
file (check the Database section below for more info)main
method in JtSpringProjectApplication.java
)basedata.sql
script on the database, you can log in with the following credentials as admin; otherwise you'll have to manually create an admin user in the database:
admin
123
lisa
765
MySQL or MariaDB can be used as the database for this project. The database connection can be configured in the src/main/resources/application.properties
file, with the appropriate values for the following properties:
( You'd better use another username not root, and ensure that the user has the corresponding permissions for the database. )
db.url=jdbc:mysql://[ip address of db]:[port of db]/ecommjava?createDatabaseIfNotExist=true
db.username=[username]
db.password=[password, if any]
if you met the error java.lang.IllegalArgumentException: Could not resolve placeholder 'db.driver' in value "${db.driver}"
, maybe you should change your mysql-connector-java
version in pom.xml
file according to your mysql version, don't forget to reload your Maven project.
Having done that, you must create some base data in the database. You can do that by running the basedata.sql
script on the database. Check out Google for how to do that, because it depends on what tool you are using to access said database.
The views are located in src/main/webapp/views
, but for some reason, Spring Boot doesn't recognize that directory. To remedy this, you must change the working directory of the project in your IDE. If you're using IntelliJ IDEA, follow these steps:
JtSpringProjectApplication
configuration$MODULE_WORKING_DIR$
macroWhen you run the project, the views should be found by Spring Boot and you should see a login page in http://localhost:8080/ (if not logged in previously)!
public String adminlogin() {
return "adminlogin";
}```
For any information about Spring Boot, here are some useful links!
For further reference, please consider the following sections:
The following guides illustrate how to use some features concretely: