You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Not your computer? Use a private browsing window to sign in. Learn more about using Guest mode
æ ªå¼ä¼ç¤¾DTS ãããã¯ã¼ã¯äºæ¥æ¬é¨æå±ãStruts/Springãã¼ã¹ã®ãã¬ã¼ã ã¯ã¼ã¯ã®ç 究éçºãä¸å¿ã«æ¥åãè¡ã£ã¦ãããã¾ãï¼ãã¬ã¼ã ã¯ã¼ã¯ã®å©ç¨ãéçºããã»ã¹ã«é¢ããè¬å¸«ãè¡ã£ã¦ããã æ ªå¼ä¼ç¤¾DTS ãããã¯ã¼ã¯äºæ¥æ¬é¨ ããã¸ã§ã¯ãããã¼ã¸ã£ãJavaãä¸å¿ã«ãã¬ã¼ã ã¯ã¼ã¯éçºãéçºããã»ã¹å®ç¾©ãªã©å¹ åºãæ´»èºä¸ãStrutsIDEã³ããã¿ãèæ¸ãã¾ããã¨Eclipse!ãVol.1ãï¼çºè¡ï¼ã¤ã³ãã¬ã¹ã³ãã¥ãã±ã¼ã·ã§ã³ãºï¼ã ä»åã¯ï¼ç±³GoogleãJavaã§éçºããDIï¼Dependency Injectionï¼ãã¬ã¼ã ã¯ã¼ã¯ãGuiceï¼ã¸ã¥ã¼ã¹ï¼ããåãä¸ãã¾ããåä½ã§ä½¿ç¨ãããã¨ã¯ãã¡ããï¼Webã¢ããªã±ã¼ã·ã§ã³ã«çµã¿è¾¼ãæ¹æ³ãï¼Spring FrameworkãDWRã¨ã®é£æºã解説ãã¾ãã XMLå®ç¾©ã£ã¦ããããã§ããï¼ Springãã¯ããã¨ãããã¬ã¼ã ã¯ã¼ã¯ã«ãã
Java, Wicket ãã¤ã誰ããããã¨æã£ã¦ã¾ããããã¤ãã«Wicketã®Google Guiceãµãã¼ããéçºãããããã§ããClick Frameworkã¨ä¸¦ãã§ä¸çªããããªJavaã¦ã§ããã¬ã¼ã ã¯ã¼ã¯ã§ããWicketã¨ãGoogleã®Dependency Injectionãã¬ã¼ã ã¯ã¼ã¯Guiceãã¤ãã«çµ±åã§ããããã§ãã Wicketã«ã¯æ©ãã«Springæ¡å¼µæ©è½ã追å ããã¦ãã¾ããããå½å ã§ã¯ãããã¡ããããã«ããS2Wicketã§Seasar 2ããµãã¼ãããã¦ãã¾ããããã«Guiceãå ããã Google Guiceã¯DIã³ã³ããã¨ãã¦ã¯ç°è²ã®åå¨ã§ãããã®ããªã·ã¼ã«ã¯ãåå®å ¨æ§éè¦ãã¨ããanti-staticãã¨ãæ¸ãã¦ã¾ããããããã¯XMLã§ã¯ãªãã¦Javaã³ã¼ãã§ã¤ã³ã¿ã¼ãã§ã¼ã¹ã¨å®è£ ã¯ã©ã¹ãçµã³ã¤ããã¨ããããæ¹ãè¦ã¦ããã¨ã¦ãJavaå¯ããæåã«ãã®çº
1åç®ã«ç¶ããSpring Java Configurationã試ãã¦ã¿ããã¨æãã¾ããä»åã¯AOPãã¡ãªã¿ã«ä»å±ã®ããã¥ã¡ã³ãã«ã¯AOPã®èª¬æãç¡ãã£ãã®ã§ï¼ãããM1ãªãªã¼ã¹ï¼ããã¹ãã±ã¼ã¹ãåèã«è©¦ãã¦ã¿ã¾ãã Spring Java Configurationã§ã®AOPå®ç¾© injectããServiceã®ã¤ã³ã¿ãã§ã¼ã¹ã¨å®è£ ã¯ã©ã¹ãããã¦injectãããClientå®è£ ã¯ã©ã¹ã¯ãååã¨åããã®ã使ç¨ãã¾ããAOPã¯æ¢åã®å®è£ ãå¤æ´ããã«ééçã«å¦çã追å ï¼å¤æ´ï¼ã§ããã®ã売ãã§ããããå½ç¶ã¨è¨ãã°å½ç¶ã§ãã ã§ãååã®ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ã¯ã©ã¹ã«AOPã®å®ç¾©ã追å ãã¦ãã¤ã³ã¿ã¼ã»ãã¿ãæ¸ãã¡ããã¾ãã @Configuration public class SpringConfigurationWithAOP { @Bean public Service service()
SpringFramework 2.0.4ã§ãã¡ããã©ãã³ããã¼ã¯ã«é¢ä¿ããé¨åã®ããã©ã¼ãã³ã¹ãã¥ã¼ãã³ã°ãè¡ã£ãã¨ã®äºãªã®ã§ï¼è©³ããã¯æ¬¡ã®ã¨ã³ããªåç §ï¼ãå度ãã³ããã¼ã¯ãè¡ãã¾ãããSeasar2ãææ°çã«å ¥ãæ¿ããä¸ã§ãã»ããã¢ããå¦çã³ã¼ããä¸é¨å¤æ´ãã¦ãã¾ãã è¨æ¸¬å 容 ãã¼ã¸ã§ã³ã¯ãSpring 2.0.4 / Guice 1.0 / Seasar2 2.4.12 ã¤ã³ã¹ã¿ã³ã¹åå¾ã¯AOPæãã¨AOPç¡ãã®ä¸¡æ¹ãè¨æ¸¬ï¼ååã¯æãã®ã¿ã§ããããä»åã¯ç¡ããè¨æ¸¬ãã¾ããï¼ å ¨ã¦ãããã¿ã¤ãï¼æ¯åæ°ããã¤ã³ã¹ã¿ã³ã¹ãåå¾ï¼ åå¾ããã¤ã³ã¹ã¿ã³ã¹ã®å®è¡æéã¯ãAOPæãã®ã¿è¨æ¸¬ï¼AOPç¡ãã¯å¤ãããªãã¯ããªã®ã§ï¼ çæãã¦æ¬²ããäºé ã¯ååã®åç½®ãã«ããã¾ã ãã³ããã¼ã¯çµæ - get instance (NO AOP)- Spring: 24,336 creations/s Gui
Guice㨠Springframeworkã®æ大ã®éãã¯DIãAOPã®è¨å®ãJavaã³ã¼ãã§æ¸ããXMLã§æ¸ããã§ãããå®ã¯(?)Springã§ãJava ã³ã¼ãã«ããè¨å®ã®è¨è¿°æ段ãç¨æããã¦ãã¾ã*1ãä»åã¯ãã®"Spring Java Configuration"ãç°¡åã«è¦ã¦ã¿ã¾ãããªããã¾ã ãã¤ã«ã¹ãã¼ã³1ãªã®ã§ãç¨æããã¦ããã¨ããããã¯æºåããã¦ããããããã¯è¨ç»ä¸ã¨è¨ãæ¹ãé©åããç¥ãããä»å試ãå 容ãä»å¾ã®ãªãªã¼ã¹ã§è²ã å¤ããå¯è½æ§ãããã¾ãã Spring Java Configurationã®æãåºæ¬çãªãµã³ãã« ã¾ãinjectããããµã¼ãã¹ãã¤ã³ã¿ãã§ã¼ã¹ã¨ãã®å®è£ ã§ãã public interface Service { String getResponse(String msg); } public class ServiceImpl implements
Guiceã¯Javaã®Genericsæ©è½ããã«æ´»ç¨ããã¿ã¤ãã»ã¼ããªãã¬ã¼ã ã¯ã¼ã¯ã§ãã ç§ããå½åããGenericsæ©è½ã¯ãJavaã®éçåä»ãè¨èªçè¯ããå¼·åããç´ æ´ãããæ©è½ã ã¨æã£ã¦ãã¾ããããå®ç¨æ¹æ³ã¨ãã¦ã¯Collectionãã¬ã¼ã ã¯ã¼ã¯ä»¥ä¸ã®ãã®ãæãã¤ãã¾ããã§ããã ããããGuiceã¯ãã以ä¸ãªãã»ã©ã®ç´ æ´ããã使ãããã§Genericsã使ãå¯è½æ§ã示ãã¦ãã¾ãã Genericsã®æ代ã¯ãã¤ãæ¥ãã ããã¨æã£ã¦ãã¾ãããããããGuiceã®ç»å ´ã§æ¡å¤æ©ãæ¥ããã§ãã ããã§ã¯ãModuleã§ã®å¦çbind()ã¡ã½ããã¨ããã®æ»ãå¤ã§ããAnnotatedBindingBuilderã¤ã³ã¿ã¼ãã§ã¤ã¹ã®to()ã¡ã½ããã®ã½ã¼ã¹ãèªã¿è§£ãã¦ã¿ã¾ãã ãã®ãªãã§Gnenericsã®ä½¿ãæ¹ãå¦ãã§ããã¾ãããã å ã¡ã½ãã AbstractModuleã¯ã©ã¹ bind
AOPç¨éã®73%ãå ãããã©ã³ã¶ã¯ã·ã§ã³ç®¡ç*1ããããåããã°ã¨ããããGuiceã使ã£ã¦ã¿ããã¨ãã人ãå¢ãããããããªãã®ã§ãã¡ãã£ã¨è©¦ãã¦ã¿ã¾ãã ãã©ã³ã¶ã¯ã·ã§ã³æ©è½ã¯ä»ã©ã¤ãã©ãªã使ã Guiceã¯ãã©ã³ã¶ã¯ã·ã§ã³ã«é¢ããæ©è½ãä¸åæã£ã¦ãã¾ãããããã¥ã¡ã³ããè¦ãã¨"@Transactional"ã¨ãæ¸ãã¦ãã£ã¦ç´ããããã®ã§ããããããããã¢ããã¼ã·ã§ã³ã使ãã°ï¼ãã¨ããç¨åº¦ã®è©±ã§ãããªã®ã§ãå®éã«ãã©ã³ã¶ã¯ã·ã§ã³ç®¡çãè¡ãå ´åã¯ãèªåã§å®è£ ããããä»ã®ã©ã¤ãã©ãªã®æ©è½ã使ãäºã«ãªãã¾ããä»åã¯Springã®TransactionInterceptorã使ã£ã¦ã¿ã¾ãããSesar2ã§ããã¶ãåããããªäºãåºæ¥ã¾ãããã¡ãã£ã¨ã¤ã³ã¿ã¼ã»ãã¿ãæ¸ãã°Hibernateã®ãã©ã³ã¶ã¯ã·ã§ã³æ©è½ã使ãäºãåºæ¥ãã¯ãã§ãã ä»åã®è¦ä»¶ ã¡ã½ããã«@Transactionalã¨æ¸ãã¨ã
Springã¨ã®çµ±åæ段2ã¤ç®ãSpringIntegration#fromSpringã¡ã½ããã«ã¤ãã¦ã§ãã fromSpring()ã¡ã½ããã®ã¤ã³ã¿ãã§ã¼ã¹ã¯ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ãã /** Creates a provider which looks up objects from Spring using the given name. */ public static <T> Provider<T> fromSpring(Class<T> type, String name) æ»ãã®åProviderã¯ååè¦ãéããinjectããã¤ã³ã¹ã¿ã³ã¹ãæä¾ããã¤ã³ã¿ãã§ã¼ã¹ã§ããJavaDocã³ã¡ã³ãã«ããã°ãSpringããæå®ããååã§ãªãã¸ã§ã¯ããåå¾ãã¦ãããããã§ãã fromSpring()ã使ã£ã¦ã¿ãã XMLå®ç¾©ã¨Beané¢é£ã¯ãã®11ã¨åããã®ã使ç¨ãã¾ãã®ã§çç¥ã
Springçµ±åã®2åç®ã®äºå®ã§ããããåæã¨ãã¦Providerãç解ãã¦ããã¨è¯ãããã ã£ãã®ã§ï¼ã¨ããããç解ãã¦ããªãã¨APIãããåãããªãã£ãã®ã§ï¼ãäºå®ãå¤æ´ãã¦Providerãè¦ã¦ã¿ã¾ãã Providerã¤ã³ã¿ãã§ã¼ã¹ã¯ãKeyã¯ã©ã¹ã¨å ±ã«Guiceã®DIã®æ ¸ã¨ãªã£ã¦ãããã®ã§ãä¸è¨ã§è¨ãã¨ãGuiceãinjectããã¤ã³ã¹ã¿ã³ã¹ãæä¾ããã¤ã³ã¿ãã§ã¼ã¹ãã§ããUser's Guideã«æ²è¼ããã¦ããå³ãå¼ç¨ãã¾ãã æ£ç¢ºã«ã¯åå ¸ãå½ãã£ã¦é ãã¨ãã¦ãBindingã¯injectããçºã®1çµã®ãããã³ã°ã§ãKeyããã©ãã«ï¼ä½ã«å¯¾ãã¦ï¼injectããããã示ãå¤ãProviderãããinjectããã¤ã³ã¹ã¿ã³ã¹ãæä¾ããã¤ã³ã¿ãã§ã¼ã¹ãã§ããã¤ã¾ããè²ã ãªãã®ããã£ã±ãçãã¦èª¤è§£ãæãã¤ã¤ä¸è¨ã§è¨ãã¨ããGuiceã®DIã¨ã¯ã@Implementã¢ããã¼ã·ã§ã³ãã¤
id:iad_otomamayãããGuiceã®ã¦ã¼ã¶ã¼ã¬ã¤ãã翻訳ï¼ããã¼ã¯ãã¼ï¼ï¼ãã¦ããã¦ãã®ã§ã ä¸è¦§ã«ãã¦ã¿ãããããã¨ããããã¾ãããã¨ã§ãã£ããèªã¾ãã¦ãããã¾ãï¼id:iad_otomamayãã Guice User's Guide â Java on Guice â 1. Introduction â 2. Plain Old Factories â 3. Dependency Injection By Hand ç¶ããèªã JavaExpressã®å¾ç¶ã¨ãã¦ãæ°ãã«JavaExpertãåµåããã¾ãã ãã®JavaExpertã®ç¹é2ã¨ãã¦ãid:yone098ãããid:manholeãã㨠ä¸ç·ã«Teedaã®å ¥éè¨äºãæ¸ããã¦ããã ãã¾ããã TeedaCoreããå§ã¾ããExtensionãAjaxã¨å ¨é¨ãã¾ã¨ãã¦ç´¹ä»ããã®ã¯ãããåãã¦ãããªãã§ããããã ãã¡ããS
ä¸è¨ã®Wikiã«å ¬éãã¾ãããã½ã¼ã¹ã®ç´æ¥è²¼ãä»ãã¯æ¸ãæ¹ãåãããªãã£ãã®ã§ãæ·»ä»ãã¡ã¤ã«ã«ãªã£ã¦ãã¾ãã ä¿®æ£ã追å ããã©ãã·ã¥ã¢ãããªã©å¤§æè¿ã§ãã http://www.wikihouse.com/arumani/index.php?Guice%2C%20Sring%2C%20S2%20%A5%D1%A5%D5%A5%A9%A1%BC%A5%DE%A5%F3%A5%B9%C8%E6%B3%D3
Guiceã¯Springã¨çµ±åããçºã®ã¯ã©ã¹ãç¨æãã¦ãã¾ãããã®åããã°ãSpringIntegrationãçµ±åã¨è¨ã£ã¦ãæ§ã ãªå½¢æ ãèããããã¨æãã¾ãããç¾æç¹ã§Guiceãç¨æãã¦ããã®ã¯ãSpringã®ã³ã³ããã§ç®¡çããã¦ããBeanãGuiceããåå¾/injectã§ããããã«ãããã®ã§ããããã»ã©åã£ãäºã¯ãã¦ããªãã¦ãã·ã³ãã«ãªBeanFactoryã®ã©ããã¼ã¨ãªã£ã¦ãã¾ãã SpringIntegrationã¯ã©ã¹ã«ã¯publicã¡ã½ããã2ã¤ããç¡ãã®ã§ã両æ¹è¦ã¦ã¿ã¾ããä»åã¯bindAll()ã¡ã½ããã SpringIntegration#bindAllã¡ã½ãããå¼ã³åºãã¨ãSpringã«ååã§ç»é²ããã¦ããBeanãå ¨ã¦Guiceã«ç»é²ããã¾ãããã®éãGuiceã³ã³ããã«ç»é²ãããã¤ã³ããã¯ã¹ï¼Keyã¯ã©ã¹ï¼ã¯ãåã¨ååã®ã»ãããã«ãªã£ã¦ãã¾ããJavaDocã«
ããã¤ãæ段ãããã¾ãã ã¢ããã¼ã·ã§ã³ãã®ãã®ã§åºå¥ã ex ) @JasracService / @ElicenseService ã¢ããã¼ã·ã§ã³ã§æå®ããæååã§åºå¥ã ex) @Named("JASRAC") / @Named("eLicense") 以ä¸ãããããè¦ã¦ãã¾ãã ã¢ããã¼ã·ã§ã³ãã®ãã®ã§åºå¥ ã©ã®å®è£ ãinjectãããããã¢ããã¼ã·ã§ã³ã§æå®ããæ¹æ³ã§ããã¾ãã¤ã³ã¿ãã§ã¼ã¹ã¨å®è£ ã¯ã©ã¹ã public interface Service { String getResponse(String msg); /** å®è£ ãã®1 */ class TypeAServiceImpl implements Service { public String getResponse(String msg) { return "TypeA : " + msg; } } /** å®è£
ã¡ãã£ã¨æ°åãåºãäºã®è²¬ä»»ãæãã¦ã¾ãâ¦ã åç½®ãããã¦ä¸ããã ãã¼ã¹ã¨ãªã£ã¦ããGuiceä»å±ã®ã½ã¼ã¹ã®JavaDocã³ã¡ã³ãã«ã¯ã以ä¸ã®æã§å§ã¾ã£ã¦ãã¾ãã"A semi-useless microbenchmark." 誤解ãæãã¤ã¤è¨ãã°ããã®ãã¤ã¯ããã³ããã¼ã¯ã¯ã大è±100ç²ã箸ã§ç§»ã競äºãã¿ãããªãã®ã§ã¯ãªããã¨ãéãã«ãããäºã¯ãªãã§ããããããã©ãã ãé£äºã®éãã«ã¤ãªãããã¯ãæçãé£ã¹æ¹æ¬¡ç¬¬ã§å ¨ãéããã¨ãããâ¦ãããå ¨ç¶ãã¾ãäºè¨ãã¦ãªãã§ããã ã¨ããäºã§ãã³ã³ããããã®ã¤ã³ã¹ã¿ã³ã¹åå¾å¦çã¨ãåå¾ãã1ã¤ã®ã¤ã³ã¹ã¿ã³ã¹ãã²ãããå¼ã³åºãå¦çãåãã¦è¨æ¸¬ãã¾ãããåè ãå ¨ãã¬ã¼ã ã¯ã¼ã¯ã§å®è¡âå¾è ãå ¨ãã¬ã¼ã ã¯ã¼ã¯ã§å®è¡ãã¨ããé åºã§ãã - get instance from factory - Spring: 1,891 creations/s Guice:
ãã¿ã¾ããã以åã®Springã¨Guiceã®AOPããã©ã¼ãã³ã¹æ¯è¼ã§ããããã¹ãã³ã¼ãã«ééããããã¾ãã¦ãæ¡ä»¶ãåãã«ãªã£ã¦ã¾ããã§ããã Guiceã¯æ¯åã¨ã³ãã³ã¹ããã¤ã³ã¹ã¿ã³ã¹ãä½ã£ã¦ããä¸æ¹ãSpringã¯1ã¤ã®Proxyã使ãåãã¦ããã¨ããâ¦ãæ°åãè¦ã¦ä½ããã®ææ³ããã£ã¦ãã¾ã£ãæ¹ãæ¬å½ã«ãã¿ã¾ããã // è¨æ£åï¼ããã©ã«ããªã®ã§ã·ã³ã°ã«ãã³ï¼ RootBeanDefinition proxy = new RootBeanDefinition(ProxyFactoryBean.class); // è¨æ£å¾ï¼ã·ã³ã°ã«ãã³æå®ãfalseã«ï¼ RootBeanDefinition proxy = new RootBeanDefinition(ProxyFactoryBean.class, false); ä¿®æ£å¾ã®è¨æ¸¬çµæã¯æ¬¡ã®è¨äºã«ããã¾ãã
id:koichikããã«ãS2ãæ¯è¼ã«è¿½å ãã¦ãã¨ããã³ã¡ã³ããé ããã®ã§ãè¨ãããéãã®æ¹æ³ã§è¿½å ãã¦è©¦ãã¾ãããSeasar2ã®ãã¹ãã³ã¼ãã¯ã¾!ããã®Seasar2ç¨ã³ã¼ãã«koichikããã®è¨è¿°ã追å ããã ãã®ãã®ã§ããSeasar2ã¯è§¦ã£ãäºããªãã®ã§ã·ã³ã°ã«ãã³ãã©ããåãããªãã£ãã®ã§ããããããã°ããªããè¦ããinjectããããªãã¸ã§ã¯ãã®IDãå¼ã³åºãã®ãã³ã«ç°ãªã£ã¦ããã®ã§ãæ¯åã¤ã³ã¹ã¿ã³ã¹åãã¦ããã®ã ããï¼ï¼æ¡ä»¶ã¯åãã ããï¼ã¨å¤æãã¾ãããã¾ããä¸è¨Springã®è¨æ£ãå«ã¾ãã¦ãã¾ãã æåã®3åã®çµæã¯ä»¥ä¸ã§ããSpringã«ã¨ã£ã¦ã¯ã¡ãã£ã¨â¦. Spring: 1,734 creations/s Guice: 35,161 creations/s S2: 18,395 creations/s Spring: 1,776 creations/s Guice
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}