Skip to content

Instantly share code, notes, and snippets.

@junjun-dachi
junjun-dachi / module.xml
Created June 20, 2017 16:06
JBoss WildFly 8 : log4j not logging : module.xml
<module name="org.jboss.as.logging" xmlns="urn:jboss:module:1.3">
<properties>
<property name="jboss.api" value="private">
</property>
</properties>
<resources>
<resource-root path="wildfly-logging-8.2.0.Final.jar">
</resource-root></resources>
@junjun-dachi
junjun-dachi / Application.java
Created June 20, 2017 01:55
AWS : Redirect HTTP to HTTPS : Application.java
package org.junjun.spring.util;
import org.apache.catalina.Context;
import org.apache.catalina.connector.Connector;
import org.apache.tomcat.util.descriptor.web.SecurityCollection;
import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
@junjun-dachi
junjun-dachi / elasticbeanstalk.conf
Created June 20, 2017 01:35
AWS : http redirects to https : elasticbeanstalk.conf
<!-- /etc/httpd/conf.d/elasticbeanstalk.conf -->
<virtualhost>
...
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule !/status https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
</virtualhost>
@junjun-dachi
junjun-dachi / welcome.jsp
Created June 18, 2017 16:09
Spring with Embedded Tomcat without Spring Boot : welcome.jsp
<div id="div-msg" width="100%"
style="font-family: Verdana, Geneva, sans-serif; font-size: 30px; text-align: center; padding-top: 100px;">
${message}</div>
@junjun-dachi
junjun-dachi / EchoServiceImpl.java
Created June 18, 2017 16:03
Spring with Embedded Tomcat without Spring Boot : EchoServiceImpl.java
package org.junjun.util.spring.service;
import org.springframework.stereotype.Component;
@Component
public class EchoServiceImpl implements EchoService {
@Override
public String execute(String message) {
@junjun-dachi
junjun-dachi / EchoService.java
Created June 18, 2017 16:02
Spring with Embedded Tomcat without Spring Boot : EchoService.java
package org.junjun.util.spring.service;
public interface EchoService {
String execute(String message);
}
@junjun-dachi
junjun-dachi / WelcomeController.java
Created June 18, 2017 16:00
Spring with Embedded Tomcat without Spring Boot : WelcomeController.java
package org.junjun.util.spring.controller;
import org.junjun.util.spring.service.EchoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.request.WebRequest;
@Controller
@junjun-dachi
junjun-dachi / WebConfig.java
Created June 18, 2017 15:59
Spring with Embedded Tomcat without Spring Boot : WebConfig.java
package org.junjun.util.spring.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
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.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;
@junjun-dachi
junjun-dachi / AppConfig.java
Created June 18, 2017 15:54
Spring with Embedded Tomcat without Spring Boot : AppConfig.java
package org.junjun.util.spring.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(basePackages = { "org.junjun.util.spring.service"})
public class AppConfig {
}
@junjun-dachi
junjun-dachi / WebInit.java
Created June 18, 2017 15:32
Spring with Embedded Tomcat without Spring Boot : WebInit.java
package org.junjun.util.spring.server;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import org.junjun.util.spring.config.AppConfig;
import org.junjun.util.spring.config.WebConfig;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;