Spring5 study notes (1) - "Java project introduces Spring5 (IDEA)"

Spring5 Getting Started Small Demo

Environment: IDEA 2021.1, java8, JDK1.8


1. First create a java project in idea
insert image description here
insert image description here
2. After the creation is successful, right-click the project name, click "Add Framework Support..."
insert image description here
to check Spring, click OK
insert image description here
to download...
insert image description here
3. Create a Spring configuration file (two classes are created in src for later testing).
insert image description here
After the creation is successful, configure the context for bean1.xml, and then it can be used
insert image description here


Write a small test demo

1. Write an add method in the User class, let it print casually
insert image description here
2. Configure in bean1.xml, configure the object to be created
insert image description here

3. Create a user object in the TestSpring class, and call the user
insert image description here
to run the main method of the TestSpring class to see if it is successful
insert image description here
. OK, the first Spring demo is successful!

Guess you like

Origin blog.csdn.net/qq_47354826/article/details/120443983