Spring:MVC
Aus Alexander's Wiki
Version vom 11. November 2016, 22:30 Uhr von Admin (Diskussion | Beiträge)
Umgebung
- Java JDK 1.8
- Tomcat
- Eclipse JEE Version
- Maven (Spring kommt als Maven dependency)
Erstellung
Wir benutzen den archetype spring-mvc-archetype. In Eclipse:
- File / new / Maven Project
- Create a simple project (skip archetype selection) darf NICHT gesetzt sein
- Next
- Add Archetype
- Archetype Group Id: co.ntier
- Archetype Artifact Id: spring-mvc-archetype
- Archetype Version: 1.0.2
- Repository URL: http://maven-repository.com/artifact/co.ntier/spring-mvc-archetype/1.0.2
- Next
- Eintragen des eigenen Projekts, z.B.:
- Group Id: de.taufkirchen.kluge
- Artifact Id: MySpringMvc
- Version: default, 0.0.1-SNAPSHOT.
- ackage: de.taufkirchen.kluge
Erstellung (Outdated)
- Eclipse mit neuem Workspace öffnen, z.B. analog folgende Verknüpfung:
E:\Entwicklungsumgebungen\eclipse-jee-neon-x64\eclipse.exe -data "E:\Entwicklungsumgebungen\data_and_configuration\data\PRIVAT\SpringMVC-simple" -configuration "E:\Entwicklungsumgebungen\data_and_configuration\configuration\PRIVAT\SpringMVC-simple"
- File/New/Dynamic Web Project
- Project Name setzen, z.B. SpringMVCTutorial
- Target Runtime -> Apache Tomcat 8.5
- Konvertieren des Projekts in
- m2e-eclipse muss als PlugIn in Eclipse installiert sein
- Rechte Maustaste auf das Projekt -> Configure -> "Convert to Maven Project"
- Das POM modifizieren (über die Oberfläche) und Dependencies hinzufügen
- <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.3.3.RELEASE</version>
- <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>4.3.3.RELEASE</version>
- <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>4.3.3.RELEASE</version>
- <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>4.3.3.RELEASE</version>
- <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version>