0

Merge branch 'master' into freemarker

# Conflicts:
#	src/main/java/ru/dmitriymx/skeleton/springmvc/WebApp.java
This commit is contained in:
2018-09-23 14:40:38 +03:00
5 changed files with 90 additions and 26 deletions

View File

@@ -4,7 +4,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
@@ -13,7 +13,7 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
*/
@Configuration
@EnableWebMvc
public class SpringConfigMVC extends WebMvcConfigurerAdapter {
public class SpringConfigMVC implements WebMvcConfigurer {
/**
* Компонент, отвечающий за отображение шаблонов
*

View File

@@ -14,8 +14,8 @@ import org.springframework.web.servlet.DispatcherServlet;
import java.net.InetSocketAddress;
@RequiredArgsConstructor
@Slf4j
@RequiredArgsConstructor
public class WebApp {
private final String host;
private final int port;
@@ -65,20 +65,9 @@ public class WebApp {
}
}
/**
* Для запуска можно указать два параметра: хост и порт.
* По-умолчанию: 127.0.0.1:8080
*
* @param args параметры запуска
*/
public static void main(String[] args) {
String host = "127.0.0.1";
int port = 8080;
if (args.length == 2) {
host = args[0];
port = Integer.parseInt(args[1]);
}
final String host = System.getProperty("host", "127.0.0.1");
final int port = Integer.parseInt(System.getProperty("port", "8080"));
log.info("Web app listen: {}:{}", host, port);
WebApp app = new WebApp(host, port);

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%level] (%t) \{%logger\} %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>