Commit 80d50e1b authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

14: Finalize Spring MVC example app

Task-Url: #14
parent 36d59542
Pipeline #17809 passed with stage
in 1 minute and 57 seconds
...@@ -38,7 +38,6 @@ allprojects { ...@@ -38,7 +38,6 @@ allprojects {
} }
subprojects { subprojects {
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'eclipse' apply plugin: 'eclipse'
......
plugins { plugins {
id 'war' id 'war'
id 'org.springframework.boot' version "2.3.4.RELEASE" id 'org.springframework.boot' version "2.3.4.RELEASE"
id 'io.spring.dependency-management'
} }
dependencies { dependencies {
......
package eu.dariah.de.dariahsp.sample.config; package eu.dariah.de.dariahsp.sample.config;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
...@@ -11,11 +8,9 @@ import eu.dariah.de.dariahsp.config.SecurityConfig; ...@@ -11,11 +8,9 @@ import eu.dariah.de.dariahsp.config.SecurityConfig;
import eu.dariah.de.dariahsp.config.web.AuthInfoConfigurer; import eu.dariah.de.dariahsp.config.web.AuthInfoConfigurer;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper=false)
@Slf4j
@Configuration @Configuration
@ConfigurationProperties(prefix = "auth") @ConfigurationProperties(prefix = "auth")
@Import({AuthInfoConfigurer.class}) @Import({AuthInfoConfigurer.class})
......
plugins {
id 'war'
}
ext {
tilesVersion = "3.0.8"
jstlVersion = "1.2"
}
dependencies {
implementation project(':dariahsp-core')
//implementation "org.apache.tiles:tiles-core:$tilesVersion"
//implementation "org.apache.tiles:tiles-jsp:$tilesVersion"
//implementation "org.apache.tiles:tiles-api:$tilesVersion"
implementation "org.springframework:spring-webmvc"
implementation "javax.servlet:jstl:$jstlVersion"
providedCompile "javax.servlet:javax.servlet-api:$servletApiVersion"
providedCompile "javax.servlet.jsp:javax.servlet.jsp-api:$jspApiVersion"
/*implementation "javax.servlet:jstl:$jstlVersion"
providedCompile "javax.servlet:javax.servlet-api:$servletApiVersion"
providedCompile "javax.servlet.jsp:javax.servlet.jsp-api:$jspApiVersion"
/*compile 'de.unibamberg.minf.core:core-web:5.1.2-RELEASE'
compile 'org.springframework:spring-context:4.3.6.RELEASE'
compile 'org.springframework:spring-core:4.3.6.RELEASE'
compile 'org.springframework:spring-beans:4.3.6.RELEASE'
compile 'org.springframework:spring-webmvc:4.3.6.RELEASE'
compile 'org.apache.tiles:tiles-core:3.0.7'
compile 'org.apache.tiles:tiles-jsp:3.0.7'
compile 'org.apache.tiles:tiles-api:3.0.7'
compile 'javax.servlet:jstl:1.2'
compile 'org.yaml:snakeyaml:1.18'
testCompile 'org.springframework:spring-test:4.3.6.RELEASE'
testCompile 'junit:junit:4.12'
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
providedCompile 'javax.servlet.jsp:jsp-api:2.2'*/
}
description = 'dariahsp - sample web application'
\ No newline at end of file
package eu.dariah.de.dariahsp.sample;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import eu.dariah.de.dariahsp.sample.config.SampleMvcConfig;
public class SampleWebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return null;
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[] { SampleMvcConfig.class };
}
@Override
protected String[] getServletMappings() {
return new String[] { "/" };
}
}
package eu.dariah.de.dariahsp.sample.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@ComponentScan({ "eu.dariah.de.dariahsp.sample" })
public class SampleMvcConfig implements WebMvcConfigurer {
}
package eu.dariah.de.dariahsp.sample.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
public class SampleController {
@RequestMapping("/greet")
public ModelAndView showview()
{
ModelAndView mv = new ModelAndView();
mv.setViewName("result.jsp");
mv.addObject("result",
"GeeksForGeeks Welcomes "
+ "you to Spring!");
return mv;
}
}
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" isELIgnored="false"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>${result}</h1>
</body>
</html>
<html>
<body>
<h2>Hello World!</h2>
<form action="greet">
<input type="submit" value="Press to greet">
</form>
</body>
</html>
rootProject.name = 'dariahsp' rootProject.name = 'dariahsp'
include(':dariahsp-core') include(':dariahsp-core')
include(':dariahsp-sample-boot') include(':dariahsp-sample-boot')
include(':dariahsp-sample-mvc') \ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment