The maven after fully importing the dependency package is as follows.
In order to avoid the troublesome operation of creating a maven project every time you write spring code, we use templates to develop. We delete the src under the package in the newly created project, and press Follow the steps below
1. Right-click the project name, click new------->click module
2. Let's call it HelloSpring, and we will operate step by step as shown in the figure below
3. Finally, we see the pom.xml configuration file of the total maven project. Note that it is the pom.xml of the project, not the pom.xml file of the template you created. We found that it has an additional module and module tag, which means we are in The import of this maven project is successful, and if you delete the related template, don't forget to delete the corresponding module tag and content! ! !
4. We expand the template we created and find that both java files are highlighted
but! ! ! ! , Some friends, these two java are not highlighted, that is, they are grayed out like other files. At this time, it is found that the new class project is not available. Then we continue to solve the problem according to the following methods
Click file in the menu bar, then click project structure (shortcut key is ctrl+alt+shirt+S)
We find Source Folder and Test Source Folder respectively (whisper bb: If you don’t have these two files, you can create them, but basically there are)
In steps 4 and 5, close and save, and java will be highlighted, and you can write code happily right away.
As for how to write the code, we will go into details in the next section (this section also has a lot of stuff)