SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
Servlet3-javaConfig
한방 스팀팩
JBOSS USER GROUP 이용혁
13년 9월 8일 일요일
Agenda
✓ servlet3
✓ javaConfig
✓ Spring3.2
✓ properties
✓ datasource
✓ mybatis3
✓ mongoDB
✓ cache - infinispan
✓ sitemesh
✓ DEMO
✓ Q & A
✓ Thanks
13년 9월 8일 일요일
Servlet3
✓ @WebServlet
✓ @WebFilter
✓ @WebInitParam
✓ @WebListener
✓ @MultipartConfig
http://download.oracle.com/otn-pub/jcp/servlet-3.0-fr-eval-oth-JSpec/servlet-3_0-final-spec.pdf?AuthParam=1378521700_c856fbccc3460a9c9e8be159abb92ee9
13년 9월 8일 일요일
javaConfig
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://
java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/
ns/javaee/web-app_2_5.xsd" version="2.5">
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/app-config.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
web.xml
13년 9월 8일 일요일
javaConfig with Spring
public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer
{
@Override
protected Class<?>[] getRootConfigClasses() {
return null;
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class<?>[] { WebConfig.class };
}
@Override
protected String[] getServletMappings() {
return new String[] { "/" };
}
@Override
protected Filter[] getServletFilters() {
CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
characterEncodingFilter.setEncoding("UTF-8");
characterEncodingFilter.setForceEncoding(true);
return new Filter[] { characterEncodingFilter, new SiteMeshFilter()};
}
}
WebInitializer.java
13년 9월 8일 일요일
Spring 3.2.?
http://static.springsource.org/spring-framework/docs/
3.2.0.RELEASE/spring-framework-reference/html/
mvc.html#mvc-container-config
13년 9월 8일 일요일
Spring 3.2.? with javaConfig
@EnableWebMvc
@ComponentScan(basePackages = "com.playfam.web")
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
localeChangeInterceptor.setParamName("lang");
registry.addInterceptor(localeChangeInterceptor);
}
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
Charset s = Charset.forName("UTF-8");
converters.add(new StringHttpMessageConverter(s));
}
@Bean
public ViewResolver viewResolver() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("/WEB-INF/views/");
viewResolver.setSuffix(".jsp");
return viewResolver;
}
@Bean
public MultipartResolver multipartResolver() {
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
multipartResolver.setMaxUploadSize(5*1024*1024);
return multipartResolver;
}
}
13년 9월 8일 일요일
properties
@Configuration
@PropertySource({
"classpath:db.${spring.profiles.active:local}.properties",
"classpath:conf.${spring.profiles.active:local}.properties"
})
public class PropertiesConfig {
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer(){
return new PropertySourcesPlaceholderConfigurer();
}
}
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:db.${spring.profiles.active}.properties</value>
<value>classpath:conf.${spring.profiles.active}.properties</value>
</list>
</property>
</bean>
13년 9월 8일 일요일
datasource
<tx:annotation-driven/>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${db.mssql.driverClassName}"/>
<property name="url" value="${db.mssql.url}"/>
<property name="username" value="${db.mssql.username}"/>
<property name="password" value="${db.mssql.password}"/>
<property name="maxActive" value="${db.mssql.maxActive}" />
<property name="maxIdle" value="${db.mssql.maxIdle}" />
<property name="maxWait" value="${db.mssql.maxWait}" />
<property name="defaultAutoCommit" value="${db.mssql.defaultAutoCommit}" />
</bean>
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
13년 9월 8일 일요일
datasource
@Configuration
@EnableTransactionManagement
public class DatabaseConfig {
@Profile({ "local", "dev", "stg" })
static class Local {
@Autowired Environment env;
@Bean
public DataSource dataSource() {
BasicDataSource ds = new BasicDataSource();
try{
ds.setDriverClassName(env.getProperty("db.mysql.driverClassName"));
ds.setUrl(env.getProperty("db.mysql.url"));
ds.setUsername(env.getProperty("db.mysql.username"));
ds.setPassword(env.getProperty("db.mysql.password"));
}catch(Exception e){
e.printStackTrace();
}
return ds;
}
}
@Bean
@Autowired
public DataSourceTransactionManager txManager(DataSource dataSource){
DataSourceTransactionManager txManager = new DataSourceTransactionManager();
txManager.setDataSource(dataSource);
return txManager;
}
}
@Profile({ "real" })
@Resource(name="jdbc/MyDB")
static class Prod {
@Bean
public DataSource dataSource() {
final JndiDataSourceLookup dsLookup = new JndiDataSourceLookup();
dsLookup.setResourceRef(true);
DataSource dataSource = dsLookup.getDataSource("java:comp/dnv/jdbc/MyDB");
return dataSource;
}
}
13년 9월 8일 일요일
mybaties3.?
@Configuration
//@MapperScan("classpath:com/playfam/web/model/mapper/**/*.xml")
public class MybatisConfig {
@Bean
@Autowired
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception{
SqlSessionFactoryBean sb = new SqlSessionFactoryBean();
sb.setDataSource(dataSource);
sb.setMapperLocations(
new PathMatchingResourcePatternResolver().getResources("classpath:com/playfam/web/model/mapper/*.xml")
);
sb.setConfigLocation(new DefaultResourceLoader().getResource("classpath:config_mybatis.xml"));
return sb.getObject();
}
@Bean
@Autowired
public SqlSessionTemplate sqlSession(SqlSessionFactory sqlSessionFactory){
SqlSessionTemplate s = new SqlSessionTemplate(sqlSessionFactory);
return s;
}
}
기존설정 유지
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mapperLocations" value="classpath:com/playfam/model/mapper/**/*.xml" />
<property name="configLocation" value="classpath:config_mybatis.xml" />
</bean>
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg ref="sqlSessionFactory" />
</bean>
13년 9월 8일 일요일
mongoDB
@Configuration
public class MongoConfig {
@Autowired Environment env;
@Bean
public MongoTemplate mongoTemplate() {
return new MongoTemplate(
env.getProperty("db.mongo.dbName"),
env.getProperty("db.mongo.user"),
env.getProperty("db.mongo.pass"),
env.getProperty("db.mongo.host"),
Integer.parseInt(env.getProperty("db.mongo.port")),
Boolean.parseBoolean(env.getProperty("db.mongo.autoConnectRetry")),
Integer.parseInt(env.getProperty("db.mongo.connectionsPerHost")),
Integer.parseInt(env.getProperty("db.mongo.connectTimeout")),
Integer.parseInt(env.getProperty("db.mongo.maxWaitTime")),
Integer.parseInt(env.getProperty("db.mongo.threadsAllowedToBlockForConnectionMultiplier")),
Integer.parseInt(env.getProperty("db.mongo.socketTimeout"))
);
}
}
<bean id="mongoTemplate" class="com.itembay.common.mongo.MongoTemplate">
<constructor-arg name="dbName" value="${db.mongo.name}"/>
<constructor-arg name="username" value="${db.mongo.user}"/>
<constructor-arg name="password" value="${db.mongo.pass}"/>
<constructor-arg name="host" value="${db.mongo.host}"/>
<constructor-arg name="port" value="${db.mongo.port}"/>
<constructor-arg name="autoConnectRetry" value="${db.mongo.autoConnectRetry}"/>
<constructor-arg name="connectionsPerHost" value="${db.mongo.connectionsPerHost}"/>
<constructor-arg name="connectTimeout" value="${db.mongo.connectTimeout}"/>
<constructor-arg name="maxWaitTime" value="${db.mongo.maxWaitTime}"/>
<constructor-arg name="threadsAllowedToBlockForConnectionMultiplier" value="$
{db.mongo.threadsAllowedToBlockForConnectionMultiplier}"/>
<constructor-arg name="socketTimeout" value="${db.mongo.socketTimeout}"/>
<constructor-arg name="cacheConfigPath" value="${cache.prop.path}"/>
</bean>
13년 9월 8일 일요일
mongoDB
public class MongoTemplate {
private static DB db;
private static MongoClient mongoClient;
public MongoTemplate(String dbName, String username, String password,
String host, int port, boolean autoConnectRetry,
int connectionsPerHost, int connectTimeout,
int maxWaitTime, int threadsAllowedToBlockForConnectionMultiplier,
int socketTimeout) {
if(mongoClient == null){
Builder b = MongoClientOptions.builder();
b.autoConnectRetry(autoConnectRetry);
b.connectionsPerHost(connectionsPerHost);
b.connectTimeout(connectTimeout);
b.maxWaitTime(maxWaitTime);
b.threadsAllowedToBlockForConnectionMultiplier(threadsAllowedToBlockForConnectionMultiplier);
b.socketTimeout(socketTimeout);
MongoClientOptions options = b.build();
try {
List<ServerAddress> list = new ArrayList<ServerAddress>();
for(String h : host.split(";")){
list.add(new ServerAddress(h.split(":")[0], Integer.parseInt(h.split(":")[1])));
}
mongoClient = new MongoClient(list,options);
mongoClient.setWriteConcern(WriteConcern.SAFE);
db = mongoClient.getDB(dbName);
db.authenticate(username, password.toCharArray());
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static DBCollection getDBCollection(String collectionName){
return db.getCollection(collectionName);
}
}
13년 9월 8일 일요일
cache - infinispan
@Configuration
@EnableCaching
public class InfinispanConfig {
@Bean
public SpringRemoteCacheManagerFactoryBean cacheManager() throws Exception{
SpringRemoteCacheManagerFactoryBean cacheManager = new SpringRemoteCacheManagerFactoryBean();
String active = System.getProperty("spring.profiles.active", "local");
cacheManager.setConfigurationPropertiesFileLocation(
new DefaultResourceLoader().getResource("classpath:hotrod-client-"+active+".properties")
);
return cacheManager;
}
} @Autowired CacheManager cacheManager;
@Test
public void test() throws Exception {
//obtain a handle to the remote default cache
Cache cache = cacheManager.getCache("default");
//now add something to the cache and make sure it is there
cache.put("car", "ferrari");
assert cache.get("car").get().equals("ferrari");
cache.evict("car");
assert cache.get("car").equals(null);
}
https://docs.jboss.org/author/display/ISPN/Using+Infinispan+as+a+Spring+Cache+provider
13년 9월 8일 일요일
cache - infinispan
✓ @Cacheable
✓ @CachePut
✓ @CacheEvict
@Cacheable(value = "authCache", key = "#key")
public DBObject getAuthInfo(String key) throws Exception
@CachePut(value = "authCache", key = "#key")
public DBObject generateAuthInfo(String key) throws Exception
@CacheEvict(value = "authCache", key = "#key")
public void removeAuthInfo(String key) throws Exception
13년 9월 8일 일요일
sitemesh@Override
protected Filter[] getServletFilters() {
CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
characterEncodingFilter.setEncoding("UTF-8");
characterEncodingFilter.setForceEncoding(true);
return new Filter[] { characterEncodingFilter, new SiteMeshFilter()};
}
<?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/WEB-INF/decorators/">
<excludes>
<pattern>/rss/*</pattern>
<pattern>/test/*</pattern>
<pattern>*.json</pattern>
</excludes>
<decorator name="default" page="mobileLayout.jsp">
<pattern>/</pattern>
</decorator>
<decorator name="mobile" page="webLayout.jsp">
<pattern>*.m</pattern>
</decorator>
<decorator name="app" page="appLayout.jsp">
<pattern>*.app</pattern>
</decorator>
</decorators>
13년 9월 8일 일요일
Thank You !
Q & A
www.playfam.com
unlogicaldev@gmail.com
https://github.com/unlogicaldev/springServlet3JavaConfig
13년 9월 8일 일요일

Más contenido relacionado

La actualidad más candente

Unit testing: unitils & dbmaintain
Unit testing: unitils & dbmaintainUnit testing: unitils & dbmaintain
Unit testing: unitils & dbmaintainnevenfi
 
Assertj-DB
Assertj-DBAssertj-DB
Assertj-DBfbenault
 
Talkaboutlithium
TalkaboutlithiumTalkaboutlithium
Talkaboutlithiumnoppoman722
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebookguoqing75
 
SpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSunghyouk Bae
 
Sexy.js: A Sequential Ajax (Sajax) library for jQuery
Sexy.js: A Sequential Ajax (Sajax) library for jQuerySexy.js: A Sequential Ajax (Sajax) library for jQuery
Sexy.js: A Sequential Ajax (Sajax) library for jQueryDave Furfero
 
Zendcon 2007 Api Design
Zendcon 2007 Api DesignZendcon 2007 Api Design
Zendcon 2007 Api Designunodelostrece
 
Drupal as a web framework
Drupal as a web frameworkDrupal as a web framework
Drupal as a web frameworkAdam Kalsey
 
Nagios Conference 2012 - Sheeri Cabral - Alerting With MySQL and Nagios
Nagios Conference 2012 - Sheeri Cabral - Alerting With MySQL and NagiosNagios Conference 2012 - Sheeri Cabral - Alerting With MySQL and Nagios
Nagios Conference 2012 - Sheeri Cabral - Alerting With MySQL and NagiosNagios
 
DBD::SQLite
DBD::SQLiteDBD::SQLite
DBD::SQLitecharsbar
 
Multi Client Development with Spring - Josh Long
Multi Client Development with Spring - Josh Long Multi Client Development with Spring - Josh Long
Multi Client Development with Spring - Josh Long jaxconf
 
Azure Expert Leading Camp UA - 2015
Azure Expert Leading Camp UA - 2015Azure Expert Leading Camp UA - 2015
Azure Expert Leading Camp UA - 2015Oleg Chorny
 
Managing a shared mysql farm dpc11
Managing a shared mysql farm dpc11Managing a shared mysql farm dpc11
Managing a shared mysql farm dpc11Combell NV
 
HTML5 JavaScript APIs
HTML5 JavaScript APIsHTML5 JavaScript APIs
HTML5 JavaScript APIsRemy Sharp
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetWalter Heck
 
Plmce2015 java 101 - david bennett
Plmce2015   java 101 - david bennettPlmce2015   java 101 - david bennett
Plmce2015 java 101 - david bennettDavid Bennett
 
OSGi framework overview
OSGi framework overviewOSGi framework overview
OSGi framework overviewBalduran Chang
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0bcoca
 

La actualidad más candente (20)

Unit testing: unitils & dbmaintain
Unit testing: unitils & dbmaintainUnit testing: unitils & dbmaintain
Unit testing: unitils & dbmaintain
 
Assertj-DB
Assertj-DBAssertj-DB
Assertj-DB
 
Talkaboutlithium
TalkaboutlithiumTalkaboutlithium
Talkaboutlithium
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook
 
SpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSL
 
Sexy.js: A Sequential Ajax (Sajax) library for jQuery
Sexy.js: A Sequential Ajax (Sajax) library for jQuerySexy.js: A Sequential Ajax (Sajax) library for jQuery
Sexy.js: A Sequential Ajax (Sajax) library for jQuery
 
Hadoop on aws amazon
Hadoop on aws amazonHadoop on aws amazon
Hadoop on aws amazon
 
Zendcon 2007 Api Design
Zendcon 2007 Api DesignZendcon 2007 Api Design
Zendcon 2007 Api Design
 
Drupal as a web framework
Drupal as a web frameworkDrupal as a web framework
Drupal as a web framework
 
Nagios Conference 2012 - Sheeri Cabral - Alerting With MySQL and Nagios
Nagios Conference 2012 - Sheeri Cabral - Alerting With MySQL and NagiosNagios Conference 2012 - Sheeri Cabral - Alerting With MySQL and Nagios
Nagios Conference 2012 - Sheeri Cabral - Alerting With MySQL and Nagios
 
DBD::SQLite
DBD::SQLiteDBD::SQLite
DBD::SQLite
 
Multi Client Development with Spring - Josh Long
Multi Client Development with Spring - Josh Long Multi Client Development with Spring - Josh Long
Multi Client Development with Spring - Josh Long
 
Azure Expert Leading Camp UA - 2015
Azure Expert Leading Camp UA - 2015Azure Expert Leading Camp UA - 2015
Azure Expert Leading Camp UA - 2015
 
Algotitmo Moinho
Algotitmo MoinhoAlgotitmo Moinho
Algotitmo Moinho
 
Managing a shared mysql farm dpc11
Managing a shared mysql farm dpc11Managing a shared mysql farm dpc11
Managing a shared mysql farm dpc11
 
HTML5 JavaScript APIs
HTML5 JavaScript APIsHTML5 JavaScript APIs
HTML5 JavaScript APIs
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
 
Plmce2015 java 101 - david bennett
Plmce2015   java 101 - david bennettPlmce2015   java 101 - david bennett
Plmce2015 java 101 - david bennett
 
OSGi framework overview
OSGi framework overviewOSGi framework overview
OSGi framework overview
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0
 

Destacado

الكتاب المقدس العهد الجديد - رسالة بولس الرسول لاهل روميه
الكتاب المقدس   العهد الجديد - رسالة بولس الرسول لاهل روميهالكتاب المقدس   العهد الجديد - رسالة بولس الرسول لاهل روميه
الكتاب المقدس العهد الجديد - رسالة بولس الرسول لاهل روميهIbrahimia Church Ftriends
 
الكتاب المقدس العهد القديم - سفر التكوين
الكتاب المقدس   العهد القديم - سفر التكوينالكتاب المقدس   العهد القديم - سفر التكوين
الكتاب المقدس العهد القديم - سفر التكوينIbrahimia Church Ftriends
 
나는 거대한 꿈을 꿨다(2012년11월)
나는 거대한 꿈을 꿨다(2012년11월)나는 거대한 꿈을 꿨다(2012년11월)
나는 거대한 꿈을 꿨다(2012년11월)Ji Young Kim
 
Albert helps the BYOD phenomenon
Albert helps the BYOD phenomenonAlbert helps the BYOD phenomenon
Albert helps the BYOD phenomenonnoHold, Inc.
 
Executive-Classic Resume vs. Standard Resume
Executive-Classic Resume vs. Standard ResumeExecutive-Classic Resume vs. Standard Resume
Executive-Classic Resume vs. Standard ResumeResume Templates
 
Inv pres q32014_final
Inv pres q32014_finalInv pres q32014_final
Inv pres q32014_finalCNOServices
 
Travis Weisleder "Special Finance Online"
Travis Weisleder "Special Finance Online"Travis Weisleder "Special Finance Online"
Travis Weisleder "Special Finance Online"Sean Bradley
 
Rancangan mengajar yang betul
Rancangan mengajar yang betulRancangan mengajar yang betul
Rancangan mengajar yang betulKamariah Osman
 
Tools and practices for rapid application development
Tools and practices for rapid application developmentTools and practices for rapid application development
Tools and practices for rapid application developmentZoltán Váradi
 
Content Hub "Robotik im Pflegesektor"
Content Hub "Robotik im Pflegesektor"Content Hub "Robotik im Pflegesektor"
Content Hub "Robotik im Pflegesektor"Maisberger2012
 
20 09 12 tresc projektu rozporzadzenia
20 09 12 tresc projektu rozporzadzenia20 09 12 tresc projektu rozporzadzenia
20 09 12 tresc projektu rozporzadzeniaNowa Stepnica
 
Instant GMP Compliance Series -Better Compliance through Master Manufacturing...
Instant GMP Compliance Series -Better Compliance through Master Manufacturing...Instant GMP Compliance Series -Better Compliance through Master Manufacturing...
Instant GMP Compliance Series -Better Compliance through Master Manufacturing...InstantGMP™
 
الصهيونيه و المسيحيه نقيضان محاضرة ل الدكتور القس رياض جرجور
الصهيونيه و المسيحيه نقيضان   محاضرة ل الدكتور القس رياض جرجورالصهيونيه و المسيحيه نقيضان   محاضرة ل الدكتور القس رياض جرجور
الصهيونيه و المسيحيه نقيضان محاضرة ل الدكتور القس رياض جرجورIbrahimia Church Ftriends
 
7 advanced facebook techniques for the savvy dealer
7 advanced facebook techniques for the savvy dealer7 advanced facebook techniques for the savvy dealer
7 advanced facebook techniques for the savvy dealerSean Bradley
 

Destacado (20)

الكتاب المقدس العهد الجديد - رسالة بولس الرسول لاهل روميه
الكتاب المقدس   العهد الجديد - رسالة بولس الرسول لاهل روميهالكتاب المقدس   العهد الجديد - رسالة بولس الرسول لاهل روميه
الكتاب المقدس العهد الجديد - رسالة بولس الرسول لاهل روميه
 
Royalty
RoyaltyRoyalty
Royalty
 
الكتاب المقدس العهد القديم - سفر التكوين
الكتاب المقدس   العهد القديم - سفر التكوينالكتاب المقدس   العهد القديم - سفر التكوين
الكتاب المقدس العهد القديم - سفر التكوين
 
Svb Time
Svb TimeSvb Time
Svb Time
 
나는 거대한 꿈을 꿨다(2012년11월)
나는 거대한 꿈을 꿨다(2012년11월)나는 거대한 꿈을 꿨다(2012년11월)
나는 거대한 꿈을 꿨다(2012년11월)
 
Albert helps the BYOD phenomenon
Albert helps the BYOD phenomenonAlbert helps the BYOD phenomenon
Albert helps the BYOD phenomenon
 
Executive-Classic Resume vs. Standard Resume
Executive-Classic Resume vs. Standard ResumeExecutive-Classic Resume vs. Standard Resume
Executive-Classic Resume vs. Standard Resume
 
Inv pres q32014_final
Inv pres q32014_finalInv pres q32014_final
Inv pres q32014_final
 
Travis Weisleder "Special Finance Online"
Travis Weisleder "Special Finance Online"Travis Weisleder "Special Finance Online"
Travis Weisleder "Special Finance Online"
 
Rancangan mengajar yang betul
Rancangan mengajar yang betulRancangan mengajar yang betul
Rancangan mengajar yang betul
 
Peresmian kelas honda
Peresmian kelas hondaPeresmian kelas honda
Peresmian kelas honda
 
Arco animazione
Arco animazioneArco animazione
Arco animazione
 
Tools and practices for rapid application development
Tools and practices for rapid application developmentTools and practices for rapid application development
Tools and practices for rapid application development
 
Content Hub "Robotik im Pflegesektor"
Content Hub "Robotik im Pflegesektor"Content Hub "Robotik im Pflegesektor"
Content Hub "Robotik im Pflegesektor"
 
20 09 12 tresc projektu rozporzadzenia
20 09 12 tresc projektu rozporzadzenia20 09 12 tresc projektu rozporzadzenia
20 09 12 tresc projektu rozporzadzenia
 
Goods And Services Tax
Goods And Services TaxGoods And Services Tax
Goods And Services Tax
 
Instant GMP Compliance Series -Better Compliance through Master Manufacturing...
Instant GMP Compliance Series -Better Compliance through Master Manufacturing...Instant GMP Compliance Series -Better Compliance through Master Manufacturing...
Instant GMP Compliance Series -Better Compliance through Master Manufacturing...
 
термометры
термометрытермометры
термометры
 
الصهيونيه و المسيحيه نقيضان محاضرة ل الدكتور القس رياض جرجور
الصهيونيه و المسيحيه نقيضان   محاضرة ل الدكتور القس رياض جرجورالصهيونيه و المسيحيه نقيضان   محاضرة ل الدكتور القس رياض جرجور
الصهيونيه و المسيحيه نقيضان محاضرة ل الدكتور القس رياض جرجور
 
7 advanced facebook techniques for the savvy dealer
7 advanced facebook techniques for the savvy dealer7 advanced facebook techniques for the savvy dealer
7 advanced facebook techniques for the savvy dealer
 

Similar a spring3.2 java config Servler3

Running ms sql stored procedures in mule
Running ms sql stored procedures in muleRunning ms sql stored procedures in mule
Running ms sql stored procedures in muleAnilKumar Etagowni
 
Running ms sql stored procedures in mule
Running ms sql stored procedures in muleRunning ms sql stored procedures in mule
Running ms sql stored procedures in muleKrishnakanth Goud
 
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)DK Lee
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 updateJoshua Long
 
Jaxitalia09 Spring Best Practices
Jaxitalia09 Spring Best PracticesJaxitalia09 Spring Best Practices
Jaxitalia09 Spring Best PracticesMassimiliano Dessì
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Gunith Devasurendra
 
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdfdokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdfAppster1
 
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdfdokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdfAppster1
 
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsJava Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsIMC Institute
 
Jlook web ui framework
Jlook web ui frameworkJlook web ui framework
Jlook web ui frameworkHongSeong Jeon
 
JBoss AS Upgrade
JBoss AS UpgradeJBoss AS Upgrade
JBoss AS Upgradesharmami
 
Spring dependency injection
Spring dependency injectionSpring dependency injection
Spring dependency injectionsrmelody
 
Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Zianed Hou
 
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Arun Gupta
 
How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?Tomasz Bak
 
Java Web Development with Stripes
Java Web Development with StripesJava Web Development with Stripes
Java Web Development with StripesSamuel Santos
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration BackendArun Gupta
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVCAlive Kuo
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012Arun Gupta
 

Similar a spring3.2 java config Servler3 (20)

Running ms sql stored procedures in mule
Running ms sql stored procedures in muleRunning ms sql stored procedures in mule
Running ms sql stored procedures in mule
 
Running ms sql stored procedures in mule
Running ms sql stored procedures in muleRunning ms sql stored procedures in mule
Running ms sql stored procedures in mule
 
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 update
 
Jaxitalia09 Spring Best Practices
Jaxitalia09 Spring Best PracticesJaxitalia09 Spring Best Practices
Jaxitalia09 Spring Best Practices
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
 
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdfdokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
 
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdfdokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
 
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsJava Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom Tags
 
Jlook web ui framework
Jlook web ui frameworkJlook web ui framework
Jlook web ui framework
 
JBoss AS Upgrade
JBoss AS UpgradeJBoss AS Upgrade
JBoss AS Upgrade
 
Spring dependency injection
Spring dependency injectionSpring dependency injection
Spring dependency injection
 
Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1
 
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
 
How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?
 
Java Web Development with Stripes
Java Web Development with StripesJava Web Development with Stripes
Java Web Development with Stripes
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration Backend
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012
 

Más de YongHyuk Lee

Vert.X and MSA - DevOps
Vert.X and MSA - DevOpsVert.X and MSA - DevOps
Vert.X and MSA - DevOpsYongHyuk Lee
 
Microservices chat
Microservices chatMicroservices chat
Microservices chatYongHyuk Lee
 
2015 JBUG KOREA MEETUP - spring4 width infinispan
2015 JBUG KOREA MEETUP - spring4 width infinispan2015 JBUG KOREA MEETUP - spring4 width infinispan
2015 JBUG KOREA MEETUP - spring4 width infinispanYongHyuk Lee
 

Más de YongHyuk Lee (6)

Vert.X and MSA - DevOps
Vert.X and MSA - DevOpsVert.X and MSA - DevOps
Vert.X and MSA - DevOps
 
Microservices chat
Microservices chatMicroservices chat
Microservices chat
 
2015 JBUG KOREA MEETUP - spring4 width infinispan
2015 JBUG KOREA MEETUP - spring4 width infinispan2015 JBUG KOREA MEETUP - spring4 width infinispan
2015 JBUG KOREA MEETUP - spring4 width infinispan
 
Infinispan
InfinispanInfinispan
Infinispan
 
LBS with MongoDB
LBS with MongoDBLBS with MongoDB
LBS with MongoDB
 
OAuth2.0
OAuth2.0OAuth2.0
OAuth2.0
 

Último

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Último (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

spring3.2 java config Servler3

  • 1. Servlet3-javaConfig 한방 스팀팩 JBOSS USER GROUP 이용혁 13년 9월 8일 일요일
  • 2. Agenda ✓ servlet3 ✓ javaConfig ✓ Spring3.2 ✓ properties ✓ datasource ✓ mybatis3 ✓ mongoDB ✓ cache - infinispan ✓ sitemesh ✓ DEMO ✓ Q & A ✓ Thanks 13년 9월 8일 일요일
  • 3. Servlet3 ✓ @WebServlet ✓ @WebFilter ✓ @WebInitParam ✓ @WebListener ✓ @MultipartConfig http://download.oracle.com/otn-pub/jcp/servlet-3.0-fr-eval-oth-JSpec/servlet-3_0-final-spec.pdf?AuthParam=1378521700_c856fbccc3460a9c9e8be159abb92ee9 13년 9월 8일 일요일
  • 4. javaConfig <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http:// java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ ns/javaee/web-app_2_5.xsd" version="2.5"> <filter> <filter-name>characterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <servlet> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/classes/app-config.xml </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> web.xml 13년 9월 8일 일요일
  • 5. javaConfig with Spring public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class<?>[] getRootConfigClasses() { return null; } @Override protected Class<?>[] getServletConfigClasses() { return new Class<?>[] { WebConfig.class }; } @Override protected String[] getServletMappings() { return new String[] { "/" }; } @Override protected Filter[] getServletFilters() { CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(); characterEncodingFilter.setEncoding("UTF-8"); characterEncodingFilter.setForceEncoding(true); return new Filter[] { characterEncodingFilter, new SiteMeshFilter()}; } } WebInitializer.java 13년 9월 8일 일요일
  • 7. Spring 3.2.? with javaConfig @EnableWebMvc @ComponentScan(basePackages = "com.playfam.web") public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); } @Override public void addInterceptors(InterceptorRegistry registry) { LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); localeChangeInterceptor.setParamName("lang"); registry.addInterceptor(localeChangeInterceptor); } @Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { Charset s = Charset.forName("UTF-8"); converters.add(new StringHttpMessageConverter(s)); } @Bean public ViewResolver viewResolver() { InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); viewResolver.setPrefix("/WEB-INF/views/"); viewResolver.setSuffix(".jsp"); return viewResolver; } @Bean public MultipartResolver multipartResolver() { CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(); multipartResolver.setMaxUploadSize(5*1024*1024); return multipartResolver; } } 13년 9월 8일 일요일
  • 8. properties @Configuration @PropertySource({ "classpath:db.${spring.profiles.active:local}.properties", "classpath:conf.${spring.profiles.active:local}.properties" }) public class PropertiesConfig { @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer(){ return new PropertySourcesPlaceholderConfigurer(); } } <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:db.${spring.profiles.active}.properties</value> <value>classpath:conf.${spring.profiles.active}.properties</value> </list> </property> </bean> 13년 9월 8일 일요일
  • 9. datasource <tx:annotation-driven/> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${db.mssql.driverClassName}"/> <property name="url" value="${db.mssql.url}"/> <property name="username" value="${db.mssql.username}"/> <property name="password" value="${db.mssql.password}"/> <property name="maxActive" value="${db.mssql.maxActive}" /> <property name="maxIdle" value="${db.mssql.maxIdle}" /> <property name="maxWait" value="${db.mssql.maxWait}" /> <property name="defaultAutoCommit" value="${db.mssql.defaultAutoCommit}" /> </bean> <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> 13년 9월 8일 일요일
  • 10. datasource @Configuration @EnableTransactionManagement public class DatabaseConfig { @Profile({ "local", "dev", "stg" }) static class Local { @Autowired Environment env; @Bean public DataSource dataSource() { BasicDataSource ds = new BasicDataSource(); try{ ds.setDriverClassName(env.getProperty("db.mysql.driverClassName")); ds.setUrl(env.getProperty("db.mysql.url")); ds.setUsername(env.getProperty("db.mysql.username")); ds.setPassword(env.getProperty("db.mysql.password")); }catch(Exception e){ e.printStackTrace(); } return ds; } } @Bean @Autowired public DataSourceTransactionManager txManager(DataSource dataSource){ DataSourceTransactionManager txManager = new DataSourceTransactionManager(); txManager.setDataSource(dataSource); return txManager; } } @Profile({ "real" }) @Resource(name="jdbc/MyDB") static class Prod { @Bean public DataSource dataSource() { final JndiDataSourceLookup dsLookup = new JndiDataSourceLookup(); dsLookup.setResourceRef(true); DataSource dataSource = dsLookup.getDataSource("java:comp/dnv/jdbc/MyDB"); return dataSource; } } 13년 9월 8일 일요일
  • 11. mybaties3.? @Configuration //@MapperScan("classpath:com/playfam/web/model/mapper/**/*.xml") public class MybatisConfig { @Bean @Autowired public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception{ SqlSessionFactoryBean sb = new SqlSessionFactoryBean(); sb.setDataSource(dataSource); sb.setMapperLocations( new PathMatchingResourcePatternResolver().getResources("classpath:com/playfam/web/model/mapper/*.xml") ); sb.setConfigLocation(new DefaultResourceLoader().getResource("classpath:config_mybatis.xml")); return sb.getObject(); } @Bean @Autowired public SqlSessionTemplate sqlSession(SqlSessionFactory sqlSessionFactory){ SqlSessionTemplate s = new SqlSessionTemplate(sqlSessionFactory); return s; } } 기존설정 유지 <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mapperLocations" value="classpath:com/playfam/model/mapper/**/*.xml" /> <property name="configLocation" value="classpath:config_mybatis.xml" /> </bean> <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate"> <constructor-arg ref="sqlSessionFactory" /> </bean> 13년 9월 8일 일요일
  • 12. mongoDB @Configuration public class MongoConfig { @Autowired Environment env; @Bean public MongoTemplate mongoTemplate() { return new MongoTemplate( env.getProperty("db.mongo.dbName"), env.getProperty("db.mongo.user"), env.getProperty("db.mongo.pass"), env.getProperty("db.mongo.host"), Integer.parseInt(env.getProperty("db.mongo.port")), Boolean.parseBoolean(env.getProperty("db.mongo.autoConnectRetry")), Integer.parseInt(env.getProperty("db.mongo.connectionsPerHost")), Integer.parseInt(env.getProperty("db.mongo.connectTimeout")), Integer.parseInt(env.getProperty("db.mongo.maxWaitTime")), Integer.parseInt(env.getProperty("db.mongo.threadsAllowedToBlockForConnectionMultiplier")), Integer.parseInt(env.getProperty("db.mongo.socketTimeout")) ); } } <bean id="mongoTemplate" class="com.itembay.common.mongo.MongoTemplate"> <constructor-arg name="dbName" value="${db.mongo.name}"/> <constructor-arg name="username" value="${db.mongo.user}"/> <constructor-arg name="password" value="${db.mongo.pass}"/> <constructor-arg name="host" value="${db.mongo.host}"/> <constructor-arg name="port" value="${db.mongo.port}"/> <constructor-arg name="autoConnectRetry" value="${db.mongo.autoConnectRetry}"/> <constructor-arg name="connectionsPerHost" value="${db.mongo.connectionsPerHost}"/> <constructor-arg name="connectTimeout" value="${db.mongo.connectTimeout}"/> <constructor-arg name="maxWaitTime" value="${db.mongo.maxWaitTime}"/> <constructor-arg name="threadsAllowedToBlockForConnectionMultiplier" value="$ {db.mongo.threadsAllowedToBlockForConnectionMultiplier}"/> <constructor-arg name="socketTimeout" value="${db.mongo.socketTimeout}"/> <constructor-arg name="cacheConfigPath" value="${cache.prop.path}"/> </bean> 13년 9월 8일 일요일
  • 13. mongoDB public class MongoTemplate { private static DB db; private static MongoClient mongoClient; public MongoTemplate(String dbName, String username, String password, String host, int port, boolean autoConnectRetry, int connectionsPerHost, int connectTimeout, int maxWaitTime, int threadsAllowedToBlockForConnectionMultiplier, int socketTimeout) { if(mongoClient == null){ Builder b = MongoClientOptions.builder(); b.autoConnectRetry(autoConnectRetry); b.connectionsPerHost(connectionsPerHost); b.connectTimeout(connectTimeout); b.maxWaitTime(maxWaitTime); b.threadsAllowedToBlockForConnectionMultiplier(threadsAllowedToBlockForConnectionMultiplier); b.socketTimeout(socketTimeout); MongoClientOptions options = b.build(); try { List<ServerAddress> list = new ArrayList<ServerAddress>(); for(String h : host.split(";")){ list.add(new ServerAddress(h.split(":")[0], Integer.parseInt(h.split(":")[1]))); } mongoClient = new MongoClient(list,options); mongoClient.setWriteConcern(WriteConcern.SAFE); db = mongoClient.getDB(dbName); db.authenticate(username, password.toCharArray()); } catch (Exception e) { e.printStackTrace(); } } } public static DBCollection getDBCollection(String collectionName){ return db.getCollection(collectionName); } } 13년 9월 8일 일요일
  • 14. cache - infinispan @Configuration @EnableCaching public class InfinispanConfig { @Bean public SpringRemoteCacheManagerFactoryBean cacheManager() throws Exception{ SpringRemoteCacheManagerFactoryBean cacheManager = new SpringRemoteCacheManagerFactoryBean(); String active = System.getProperty("spring.profiles.active", "local"); cacheManager.setConfigurationPropertiesFileLocation( new DefaultResourceLoader().getResource("classpath:hotrod-client-"+active+".properties") ); return cacheManager; } } @Autowired CacheManager cacheManager; @Test public void test() throws Exception { //obtain a handle to the remote default cache Cache cache = cacheManager.getCache("default"); //now add something to the cache and make sure it is there cache.put("car", "ferrari"); assert cache.get("car").get().equals("ferrari"); cache.evict("car"); assert cache.get("car").equals(null); } https://docs.jboss.org/author/display/ISPN/Using+Infinispan+as+a+Spring+Cache+provider 13년 9월 8일 일요일
  • 15. cache - infinispan ✓ @Cacheable ✓ @CachePut ✓ @CacheEvict @Cacheable(value = "authCache", key = "#key") public DBObject getAuthInfo(String key) throws Exception @CachePut(value = "authCache", key = "#key") public DBObject generateAuthInfo(String key) throws Exception @CacheEvict(value = "authCache", key = "#key") public void removeAuthInfo(String key) throws Exception 13년 9월 8일 일요일
  • 16. sitemesh@Override protected Filter[] getServletFilters() { CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(); characterEncodingFilter.setEncoding("UTF-8"); characterEncodingFilter.setForceEncoding(true); return new Filter[] { characterEncodingFilter, new SiteMeshFilter()}; } <?xml version="1.0" encoding="UTF-8"?> <decorators defaultdir="/WEB-INF/decorators/"> <excludes> <pattern>/rss/*</pattern> <pattern>/test/*</pattern> <pattern>*.json</pattern> </excludes> <decorator name="default" page="mobileLayout.jsp"> <pattern>/</pattern> </decorator> <decorator name="mobile" page="webLayout.jsp"> <pattern>*.m</pattern> </decorator> <decorator name="app" page="appLayout.jsp"> <pattern>*.app</pattern> </decorator> </decorators> 13년 9월 8일 일요일
  • 17. Thank You ! Q & A www.playfam.com unlogicaldev@gmail.com https://github.com/unlogicaldev/springServlet3JavaConfig 13년 9월 8일 일요일