fix spring config

This commit is contained in:
DOHA 2017-08-05 13:12:33 +02:00
parent beb0116cf7
commit 9c74046f8a
5 changed files with 30 additions and 35 deletions

View File

@ -21,16 +21,17 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- Spring Boot Starter Mail dependency --> <!-- Spring Boot Starter Mail dependency -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId> <artifactId>spring-boot-starter-mail</artifactId>
</dependency> </dependency>
<!-- The following two dependencies included to render jsp pages --> <!-- The following two dependencies included to render jsp pages -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId> <artifactId>jstl</artifactId>

View File

@ -2,10 +2,11 @@ package com.baeldung.spring;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication @SpringBootApplication
public class Application { public class Application extends SpringBootServletInitializer {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(Application.class, args); SpringApplication.run(Application.class, args);
} }

View File

@ -57,7 +57,7 @@
</build> </build>
<properties> <properties>
<apacheds.version>1.5.7</apacheds.version> <apacheds.version>1.5.5</apacheds.version>
</properties> </properties>
</project> </project>

View File

@ -1,8 +1,9 @@
package org.baeldung; package org.baeldung;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan; import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@ -11,17 +12,22 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
* class to run up a Jetty Server (on http://localhost:8080) * class to run up a Jetty Server (on http://localhost:8080)
* *
*/ */
@EnableAutoConfiguration @SpringBootApplication
@ComponentScan("org.baeldung") public class SampleLDAPApplication extends SpringBootServletInitializer {
public class SampleLDAPApplication extends WebMvcConfigurerAdapter {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(SampleLDAPApplication.class, args); SpringApplication.run(SampleLDAPApplication.class, args);
} }
@Bean
public WebMvcConfigurerAdapter adapter() {
return new WebMvcConfigurerAdapter() {
@Override @Override
public void addViewControllers(ViewControllerRegistry registry) { public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login"); registry.addViewController("/login")
.setViewName("login");
}
};
} }
} }

View File

@ -33,12 +33,6 @@
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId> <artifactId>spring-core</artifactId>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
@ -79,6 +73,12 @@
<artifactId>spring-oxm</artifactId> <artifactId>spring-oxm</artifactId>
</dependency> </dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons-logging.version}</version>
</dependency>
<!-- marshalling --> <!-- marshalling -->
<dependency> <dependency>
@ -105,24 +105,11 @@
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId> <artifactId>httpcore</artifactId>
<version>${httpcore.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<!-- util --> <!-- util -->
@ -213,7 +200,7 @@
<!-- util --> <!-- util -->
<guava.version>19.0</guava.version> <guava.version>19.0</guava.version>
<commons-lang3.version>3.5</commons-lang3.version> <commons-lang3.version>3.5</commons-lang3.version>
<commons-logging.version>1.2</commons-logging.version>
<httpcore.version>4.4.5</httpcore.version> <httpcore.version>4.4.5</httpcore.version>
<httpclient.version>4.5.2</httpclient.version> <httpclient.version>4.5.2</httpclient.version>