{"id":589,"date":"2022-11-26T18:54:59","date_gmt":"2023-10-30T02:41:52","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/"},"modified":"2025-08-01T00:52:02","modified_gmt":"2025-07-31T15:52:02","slug":"spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/","title":{"rendered":"Spring\u306eIoC\u3001Spring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb"},"content":{"rendered":"<p>\u300cSpring IoC\u306e\u30b5\u30f3\u30d7\u30eb\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3078\u3088\u3046\u3053\u305d\u3002Spring Framework\u306f\u3001\u5236\u5fa1\u306e\u53cd\u8ee2\u306e\u539f\u5247\u306b\u57fa\u3065\u3044\u3066\u69cb\u7bc9\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4f9d\u5b58\u6027\u6ce8\u5165\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306bIoC\u3092\u5b9f\u88c5\u3059\u308b\u305f\u3081\u306e\u624b\u6cd5\u3067\u3059\u3002\u300d<\/p>\n<h2>Spring IoC<br \/>\n\u30b9\u30d7\u30ea\u30f3\u30b0IoC<\/h2>\n<p>\u4eca\u65e5\u306fSpring IoC\u30b3\u30f3\u30c6\u30ca\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002\u307e\u305f\u3001Spring Bean\u306b\u3064\u3044\u3066\u3082\u78ba\u8a8d\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001Spring IoC\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306e\u7570\u306a\u308b\u30bb\u30af\u30b7\u30e7\u30f3\u3078\u306e\u30af\u30a4\u30c3\u30af\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u306e\u305f\u3081\u306e\u76ee\u6b21\u3067\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>Spring IoC\uff08Spring\u306eInversion of Control\uff09<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>Spring Bean\uff08Spring\u306eBean\uff09<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>Spring Bean Scopes\uff08Spring\u306eBean\u306e\u30b9\u30b3\u30fc\u30d7\uff09<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>Spring Bean Configuration\uff08Spring\u306eBean\u306e\u8a2d\u5b9a\uff09<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>Spring IoC and Spring Bean Example\uff08Spring\u306eIoC\u3068Bean\u306e\u4f8b\uff09<\/ol>\n<\/li>\n<\/ol>\n<p>XML\u30d9\u30fc\u30b9\u306eSpring Bean\u306e\u8a2d\u5b9a<br \/>\n\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u30d9\u30fc\u30b9\u306eSpring Bean\u306e\u8a2d\u5b9a<br \/>\nJava\u30d9\u30fc\u30b9\u306eSpring Bean\u306e\u8a2d\u5b9a<\/p>\n<h3>\u30b9\u30d7\u30ea\u30f3\u30b0\u306eIoC\u30b3\u30f3\u30c6\u30ca<\/h3>\n<p>Spring IoC\u306f\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u9593\u306e\u758e\u7d50\u5408\u3092\u5b9f\u73fe\u3059\u308b\u305f\u3081\u306e\u30e1\u30ab\u30cb\u30ba\u30e0\u3067\u3059\u3002\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u758e\u7d50\u5408\u5316\u3057\u3001\u30e9\u30f3\u30bf\u30a4\u30e0\u6642\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u4ed6\u306e\u30a2\u30bb\u30f3\u30d6\u30e9\u30fc\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3088\u3063\u3066\u6ce8\u5165\u3057\u307e\u3059\u3002Spring IoC\u30b3\u30f3\u30c6\u30ca\u306f\u3001\u4f9d\u5b58\u95a2\u4fc2\u3092\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u6ce8\u5165\u3057\u3001\u4f7f\u7528\u53ef\u80fd\u306a\u72b6\u614b\u306b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002Spring\u306e\u4f9d\u5b58\u6027\u6ce8\u5165\u3092\u4f7f\u7528\u3057\u3066\u3001IoC\u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u5b9f\u88c5\u3059\u308b\u65b9\u6cd5\u3092\u3059\u3067\u306b\u898b\u3066\u304d\u307e\u3057\u305f\u3002Spring IoC\u30b3\u30f3\u30c6\u30ca\u306e\u30af\u30e9\u30b9\u306f\u3001org.springframework.beans\u3068org.springframework.context\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u4e00\u90e8\u3067\u3059\u3002Spring IoC\u30b3\u30f3\u30c6\u30ca\u306f\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u89e3\u9664\u3059\u308b\u305f\u3081\u306e\u3055\u307e\u3056\u307e\u306a\u65b9\u6cd5\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u3002BeanFactory\u306f\u3001Spring IoC\u30b3\u30f3\u30c6\u30ca\u306e\u30eb\u30fc\u30c8\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3067\u3059\u3002ApplicationContext\u306f\u3001BeanFactory\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u306e\u5b50\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3067\u3001Spring AOP\u306e\u6a5f\u80fd\u3001i18n\u306a\u3069\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002ApplicationContext\u306e\u3044\u304f\u3064\u304b\u306e\u6709\u7528\u306a\u5b50\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u306b\u306f\u3001ConfigurableApplicationContext\u3068WebApplicationContext\u304c\u3042\u308a\u307e\u3059\u3002Spring\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306f\u3001Spring\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u53d6\u5f97\u3057\u3001Spring Bean\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3067\u304d\u308b\u3055\u307e\u3056\u307e\u306a\u6709\u7528\u306aApplicationContext\u306e\u5b9f\u88c5\u30af\u30e9\u30b9\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u3002\u4f7f\u7528\u3067\u304d\u308b\u3044\u304f\u3064\u304b\u306eApplicationContext\u306e\u5b9f\u88c5\u306b\u306f\u3001\u6b21\u306e\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul class=\"post-ul\">\n<li>AnnotationConfigApplicationContext: If we are using Spring in standalone java applications and using annotations for Configuration, then we can use this to initialize the container and get the bean objects.<\/li>\n<li>ClassPathXmlApplicationContext: If we have spring bean configuration xml file in standalone application, then we can use this class to load the file and get the container object.<\/li>\n<li>FileSystemXmlApplicationContext: This is similar to ClassPathXmlApplicationContext except that the xml configuration file can be loaded from anywhere in the file system.<\/li>\n<li>AnnotationConfigWebApplicationContext and XmlWebApplicationContext for web applications.<\/li>\n<\/ul>\n<p>\u901a\u5e38\u3001\u3082\u3057Spring MVC\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u4f5c\u696d\u3057\u3066\u3044\u3066\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304cSpring Framework\u3092\u4f7f\u7528\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u8d77\u52d5\u3057\u305f\u6642\u306bSpring IoC\u30b3\u30f3\u30c6\u30ca\u304c\u521d\u671f\u5316\u3055\u308c\u3001\u307e\u305f\u3001\u7279\u5b9a\u306ebean\u304c\u8981\u6c42\u3055\u308c\u305f\u6642\u306b\u4f9d\u5b58\u95a2\u4fc2\u304c\u81ea\u52d5\u7684\u306b\u6ce8\u5165\u3055\u308c\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u30b9\u30bf\u30f3\u30c9\u30a2\u30ed\u30f3\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u304a\u3044\u3066\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u3069\u3053\u304b\u3067\u30b3\u30f3\u30c6\u30ca\u3092\u521d\u671f\u5316\u3057\u3001\u305d\u306e\u5f8c\u3001Spring\u306ebean\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>\u30b9\u30d7\u30ea\u30f3\u30b0\u30d3\u30fc\u30f3<\/h3>\n<p>Spring Bean\u3068\u306f\u7279\u5225\u306a\u3082\u306e\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002Spring\u30b3\u30f3\u30c6\u30ca\u3092\u4ecb\u3057\u3066\u521d\u671f\u5316\u3059\u308bSpring\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3001\u3059\u3079\u3066Spring Bean\u3068\u547c\u3070\u308c\u307e\u3059\u3002\u901a\u5e38\u306eJava POJO\u30af\u30e9\u30b9\u3082\u3001\u8a2d\u5b9a\u30e1\u30bf\u30c7\u30fc\u30bf\u60c5\u5831\u3092\u63d0\u4f9b\u3057\u3066\u30b3\u30f3\u30c6\u30ca\u3092\u4ecb\u3057\u3066\u521d\u671f\u5316\u3055\u308c\u308b\u3088\u3046\u306b\u69cb\u6210\u3055\u308c\u308c\u3070\u3001Spring Bean\u306b\u306a\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>\u6625\u306e\u30d3\u30fc\u30f3\u30b9\u30b3\u30fc\u30d7<\/h3>\n<p>Spring Beans\u306b\u306f5\u3064\u306e\u30b9\u30b3\u30fc\u30d7\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>singleton\uff08\u30b7\u30f3\u30b0\u30eb\u30c8\u30f3\uff09- \u5404\u30b3\u30f3\u30c6\u30ca\u306b\u5bfe\u3057\u3066\u4e00\u3064\u306ebean\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u306fSpring\u306ebean\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30b9\u30b3\u30fc\u30d7\u3067\u3059\u3002\u3053\u306e\u30b9\u30b3\u30fc\u30d7\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u3001bean\u306b\u5171\u6709\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570\u304c\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u3046\u3067\u306a\u3044\u3068\u3001\u30c7\u30fc\u30bf\u306e\u4e0d\u6574\u5408\u306e\u554f\u984c\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>prototype\uff08\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\uff09- bean\u304c\u8981\u6c42\u3055\u308c\u308b\u305f\u3073\u306b\u65b0\u3057\u3044\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>request\uff08\u30ea\u30af\u30a8\u30b9\u30c8\uff09- \u3053\u308c\u306fprototype\u30b9\u30b3\u30fc\u30d7\u3068\u540c\u3058\u3067\u3059\u304c\u3001\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u4f7f\u7528\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002HTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3054\u3068\u306b\u65b0\u3057\u3044bean\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>session\uff08\u30bb\u30c3\u30b7\u30e7\u30f3\uff09- \u30b3\u30f3\u30c6\u30ca\u306b\u3088\u3063\u3066\u3001\u5404HTTP\u30bb\u30c3\u30b7\u30e7\u30f3\u306b\u5bfe\u3057\u3066\u65b0\u3057\u3044bean\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>global-session\uff08\u30b0\u30ed\u30fc\u30d0\u30eb\u30bb\u30c3\u30b7\u30e7\u30f3\uff09- \u30dd\u30fc\u30c8\u30ec\u30c3\u30c8\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u7528\u306e\u30b0\u30ed\u30fc\u30d0\u30eb\u30bb\u30c3\u30b7\u30e7\u30f3bean\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>Spring Framework\u306f\u62e1\u5f35\u6027\u304c\u3042\u308a\u3001\u81ea\u5206\u81ea\u8eab\u3067\u3082\u30b9\u30b3\u30fc\u30d7\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u307b\u3068\u3093\u3069\u306e\u5834\u5408\u3001\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u30b9\u30b3\u30fc\u30d7\u3067\u5341\u5206\u3067\u3059\u3002<\/p>\n<h3>\u30b9\u30d7\u30ea\u30f3\u30b0\u30d3\u30fc\u30f3\u306e\u8a2d\u5b9a<\/h3>\n<p>Spring Framework\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u3001\u30d3\u30fc\u30f3\u3092\u8a2d\u5b9a\u3059\u308b\u305f\u3081\u306e\u4e09\u3064\u306e\u65b9\u6cd5\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u57fa\u3065\u304f\u8a2d\u5b9a &#8211; @Service\u3084@Component\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u30b9\u30b3\u30fc\u30d7\u306e\u8a73\u7d30\u306f@Scope\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>XML\u306b\u57fa\u3065\u304f\u8a2d\u5b9a &#8211; Spring Configuration XML\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u3001\u30d3\u30fc\u30f3\u3092\u69cb\u6210\u3057\u307e\u3059\u3002Spring MVC\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001web.xml\u30d5\u30a1\u30a4\u30eb\u306b\u3044\u304f\u3064\u304b\u306e\u57fa\u672c\u7684\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u3067\u3001XML\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u3092\u81ea\u52d5\u7684\u306b\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>Java\u306b\u57fa\u3065\u304f\u8a2d\u5b9a &#8211; Spring 3.0\u304b\u3089\u3001Java\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f7f\u7528\u3057\u3066Spring\u306e\u30d3\u30fc\u30f3\u3092\u69cb\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Java\u306b\u57fa\u3065\u304f\u69cb\u6210\u306b\u4f7f\u7528\u3055\u308c\u308b\u3044\u304f\u3064\u304b\u306e\u91cd\u8981\u306a\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306f@Configuration\u3001@ComponentScan\u3001@Bean\u3067\u3059\u3002<\/ol>\n<h3>Spring IoC\u3068Spring Bean\u306e\u4f8b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8<\/h3>\n<p>\u7c21\u5358\u306aSpring\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3001Spring IoC\u30b3\u30f3\u30c6\u30ca\u3068Spring Bean\u306e\u69cb\u6210\u306e\u7570\u306a\u308b\u5074\u9762\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u79c1\u306e\u4f8b\u3067\u306f\u3001Spring Tool Suite\u3067Spring MVC\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002\u3082\u3057Spring Tool Suite\u3068Spring MVC\u304c\u521d\u3081\u3066\u306e\u5834\u5408\u306f\u3001Spring MVC\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb with Spring Tool Suite\u3092\u304a\u8aad\u307f\u304f\u3060\u3055\u3044\u3002\u6700\u7d42\u7684\u306a\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u69cb\u9020\u306f\u4ee5\u4e0b\u306e\u753b\u50cf\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002Spring IoC\u304a\u3088\u3073Spring Bean\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u7570\u306a\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4e00\u3064\u305a\u3064\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>XML\u30d9\u30fc\u30b9\u306eSpring Bean\u306e\u8a2d\u5b9a<\/h3>\n<p>MyBean\u306f\u30b7\u30f3\u30d7\u30eb\u306aJava\u306ePOJO\u30af\u30e9\u30b9\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.spring.beans;\r\n\r\npublic class MyBean {\r\n\r\n\tprivate String name;\r\n\t\r\n\tpublic String getName() {\r\n\t\treturn name;\r\n\t}\r\n\tpublic void setName(String name) {\r\n\t\tthis.name = name;\r\n\t}\r\n\t\r\n}\r\n<\/code><\/pre>\n<h4>\u6625\u306e\u8a2d\u5b9aXML\u30d5\u30a1\u30a4\u30eb<\/h4>\n<p>\u300cservlet-context.xml\u300d\u306e\u30b3\u30fc\u30c9\u306e\u5185\u5bb9\u3092\u65e5\u672c\u8a9e\u3067\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u300c\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8.xml\u300d\u30d5\u30a1\u30a4\u30eb\u306e\u30b3\u30fc\u30c9\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;beans:beans xmlns=\"https:\/\/www.springframework.org\/schema\/mvc\"\r\n\txmlns:xsi=\"https:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n\txmlns:beans=\"https:\/\/www.springframework.org\/schema\/beans\"\r\n\txmlns:context=\"https:\/\/www.springframework.org\/schema\/context\"\r\n\txsi:schemaLocation=\"https:\/\/www.springframework.org\/schema\/mvc https:\/\/www.springframework.org\/schema\/mvc\/spring-mvc.xsd\r\n\t\thttps:\/\/www.springframework.org\/schema\/beans https:\/\/www.springframework.org\/schema\/beans\/spring-beans.xsd\r\n\t\thttps:\/\/www.springframework.org\/schema\/context https:\/\/www.springframework.org\/schema\/context\/spring-context.xsd\"&gt;\r\n\r\n\t&lt;!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --&gt;\r\n\t\r\n\t&lt;!-- Enables the Spring MVC @Controller programming model --&gt;\r\n\t&lt;annotation-driven \/&gt;\r\n\r\n\t&lt;!-- Handles HTTP GET requests for \/resources\/** by efficiently serving up static resources in the ${webappRoot}\/resources directory --&gt;\r\n\t&lt;resources mapping=\"\/resources\/**\" location=\"\/resources\/\" \/&gt;\r\n\r\n\t&lt;!-- Resolves views selected for rendering by @Controllers to .jsp resources in the \/WEB-INF\/views directory --&gt;\r\n\t&lt;beans:bean class=\"org.springframework.web.servlet.view.InternalResourceViewResolver\"&gt;\r\n\t\t&lt;beans:property name=\"prefix\" value=\"\/WEB-INF\/views\/\" \/&gt;\r\n\t\t&lt;beans:property name=\"suffix\" value=\".jsp\" \/&gt;\r\n\t&lt;\/beans:bean&gt;\r\n\t\r\n\t&lt;context:component-scan base-package=\"com.scdev.spring\" \/&gt;\r\n\t\r\n\t&lt;beans:bean name=\"myBean\" class=\"com.scdev.spring.beans.MyBean\" scope=\"singleton\" &gt;&lt;\/beans:bean&gt;\r\n\t\r\n&lt;\/beans:beans&gt;\r\n<\/code><\/pre>\n<p>MyBean\u306fsingleton\u3068\u3057\u3066\u30b9\u30b3\u30fc\u30d7\u3092\u6307\u5b9a\u3057\u3066bean\u8981\u7d20\u3092\u4f7f\u7528\u3057\u3066\u69cb\u6210\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u57fa\u306b\u3057\u305fSpring Bean\u306e\u8a2d\u5b9a<\/h3>\n<pre class=\"post-pre\"><code>package com.scdev.spring.beans;\r\n\r\nimport org.springframework.context.annotation.Scope;\r\nimport org.springframework.stereotype.Service;\r\nimport org.springframework.web.context.WebApplicationContext;\r\n\r\n@Service\r\n@Scope(WebApplicationContext.SCOPE_REQUEST)\r\npublic class MyAnnotatedBean {\r\n\r\n\tprivate int empId;\r\n\r\n\tpublic int getEmpId() {\r\n\t\treturn empId;\r\n\t}\r\n\r\n\tpublic void setEmpId(int empId) {\r\n\t\tthis.empId = empId;\r\n\t}\r\n\t\r\n}\r\n<\/code><\/pre>\n<p>MyAnnotatedBean\u306f@Service\u3092\u4f7f\u7528\u3057\u3066\u69cb\u6210\u3055\u308c\u3001\u30b9\u30b3\u30fc\u30d7\u306fRequest\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>Spring IoC\uff08Inversion of Control\uff09\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u30af\u30e9\u30b9<\/h3>\n<p>HomeController\u30af\u30e9\u30b9\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u306eHTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u51e6\u7406\u3057\u307e\u3059\u3002\u3053\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u30af\u30e9\u30b9\u306b\u306f\u3001WebApplicationContext\u30b3\u30f3\u30c6\u30ca\u3092\u4ecb\u3057\u3066\u79c1\u305f\u3061\u306eSpring beans\u3092\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.spring.controller;\r\n\r\nimport java.text.DateFormat;\r\nimport java.util.Date;\r\nimport java.util.Locale;\r\n\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.context.annotation.Scope;\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.ui.Model;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\n\r\nimport com.scdev.spring.beans.MyAnnotatedBean;\r\nimport com.scdev.spring.beans.MyBean;\r\n\r\n@Controller\r\n@Scope(\"request\")\r\npublic class HomeController {\r\n\t\t\r\n\tprivate MyBean myBean;\r\n\t\r\n\tprivate MyAnnotatedBean myAnnotatedBean;\r\n\r\n\t@Autowired\r\n\tpublic void setMyBean(MyBean myBean) {\r\n\t\tthis.myBean = myBean;\r\n\t}\r\n\r\n\t@Autowired\r\n\tpublic void setMyAnnotatedBean(MyAnnotatedBean obj) {\r\n\t\tthis.myAnnotatedBean = obj;\r\n\t}\r\n\t\r\n\t\/**\r\n\t * Simply selects the home view to render by returning its name.\r\n\t *\/\r\n\t@RequestMapping(value = \"\/\", method = RequestMethod.GET)\r\n\tpublic String home(Locale locale, Model model) {\r\n\t\tSystem.out.println(\"MyBean hashcode=\"+myBean.hashCode());\r\n\t\tSystem.out.println(\"MyAnnotatedBean hashcode=\"+myAnnotatedBean.hashCode());\r\n\t\t\r\n\t\tDate date = new Date();\r\n\t\tDateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);\r\n\t\t\r\n\t\tString formattedDate = dateFormat.format(date);\r\n\t\t\r\n\t\tmodel.addAttribute(\"serverTime\", formattedDate );\r\n\t\t\r\n\t\treturn \"home\";\r\n\t}\r\n\t\r\n}\r\n<\/code><\/pre>\n<h3>\u30c7\u30d7\u30ed\u30a4\u30e1\u30f3\u30c8\u8a18\u8ff0\u5b50<\/h3>\n<p>\u79c1\u305f\u3061\u306fSpring\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u306b\u3001\u8a2d\u5b9a\u30e1\u30bf\u30c7\u30fc\u30bf\u304c\u8aad\u307f\u8fbc\u307e\u308c\u3001\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u304c\u521d\u671f\u5316\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;web-app version=\"2.5\" xmlns=\"https:\/\/java.sun.com\/xml\/ns\/javaee\"\r\n\txmlns:xsi=\"https:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n\txsi:schemaLocation=\"https:\/\/java.sun.com\/xml\/ns\/javaee https:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_2_5.xsd\"&gt;\r\n\r\n\t&lt;!-- The definition of the Root Spring Container shared by all Servlets and Filters --&gt;\r\n\t&lt;context-param&gt;\r\n\t\t&lt;param-name&gt;contextConfigLocation&lt;\/param-name&gt;\r\n\t\t&lt;param-value&gt;\/WEB-INF\/spring\/root-context.xml&lt;\/param-value&gt;\r\n\t&lt;\/context-param&gt;\r\n\t\r\n\t&lt;!-- Creates the Spring Container shared by all Servlets and Filters --&gt;\r\n\t&lt;listener&gt;\r\n\t\t&lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;\/listener-class&gt;\r\n\t&lt;\/listener&gt;\r\n\r\n\t&lt;!-- Processes application requests --&gt;\r\n\t&lt;servlet&gt;\r\n\t\t&lt;servlet-name&gt;appServlet&lt;\/servlet-name&gt;\r\n\t\t&lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;\/servlet-class&gt;\r\n\t\t&lt;init-param&gt;\r\n\t\t\t&lt;param-name&gt;contextConfigLocation&lt;\/param-name&gt;\r\n\t\t\t&lt;param-value&gt;\/WEB-INF\/spring\/appServlet\/servlet-context.xml&lt;\/param-value&gt;\r\n\t\t&lt;\/init-param&gt;\r\n\t\t&lt;load-on-startup&gt;1&lt;\/load-on-startup&gt;\r\n\t&lt;\/servlet&gt;\r\n\t\t\r\n\t&lt;servlet-mapping&gt;\r\n\t\t&lt;servlet-name&gt;appServlet&lt;\/servlet-name&gt;\r\n\t\t&lt;url-pattern&gt;\/&lt;\/url-pattern&gt;\r\n\t&lt;\/servlet-mapping&gt;\r\n\r\n&lt;\/web-app&gt;\r\n<\/code><\/pre>\n<p>\u307b\u307c\u3059\u3079\u3066\u306e\u69cb\u6210\u60c5\u5831\u306f\u3001STS\u30c4\u30fc\u30eb\u306b\u3088\u3063\u3066\u81ea\u52d5\u7684\u306b\u751f\u6210\u3055\u308c\u308b\u3072\u306a\u578b\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<h3>Spring IoC\u30d3\u30fc\u30f3\u306e\u4f8b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b\u3002<\/h3>\n<p>\u4eca\u5ea6\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u8d77\u52d5\u3059\u308b\u3068\u3001\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u304c\u8aad\u307f\u8fbc\u307e\u308c\u3001\u30da\u30fc\u30b8\u3092\u8907\u6570\u56de\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5\u3059\u308b\u3068\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u4ee5\u4e0b\u306e\u30ed\u30b0\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>MyBean hashcode=118267258\r\nMyAnnotatedBean hashcode=1703899856\r\nMyBean hashcode=118267258\r\nMyAnnotatedBean hashcode=1115599742\r\nMyBean hashcode=118267258\r\nMyAnnotatedBean hashcode=516457106\r\n<\/code><\/pre>\n<p>MyBean\u306f\u30b7\u30f3\u30b0\u30eb\u30c8\u30f3\u3068\u3057\u3066\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u30b3\u30f3\u30c6\u30ca\u306f\u5e38\u306b\u540c\u3058\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u8fd4\u3057\u3001\u30cf\u30c3\u30b7\u30e5\u30b3\u30fc\u30c9\u3082\u5e38\u306b\u540c\u3058\u3067\u3059\u3002\u540c\u69d8\u306b\u3001\u5404\u30ea\u30af\u30a8\u30b9\u30c8\u3054\u3068\u306b\u7570\u306a\u308b\u30cf\u30c3\u30b7\u30e5\u30b3\u30fc\u30c9\u3067MyAnnotatedBean\u306e\u65b0\u3057\u3044\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<h3>Spring\u306eBean\u8a2d\u5b9a\u306fJava\u3092\u30d9\u30fc\u30b9\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/h3>\n<p>\u5358\u4f53\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u30d9\u30fc\u30b9\u3068XML\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u306e\u4e21\u65b9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u552f\u4e00\u306e\u8981\u4ef6\u306f\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u306e\u3069\u3053\u304b\u3067\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u521d\u671f\u5316\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.spring.main;\r\n\r\nimport java.util.Date;\r\n\r\npublic class MyService {\r\n\r\n\tpublic void log(String msg){\r\n\t\tSystem.out.println(new Date()+\"::\"+msg);\r\n\t}\r\n}\r\n<\/code><\/pre>\n<p>MyService\u306f\u3044\u304f\u3064\u304b\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u6301\u3064\u30b7\u30f3\u30d7\u30eb\u306aJava\u30af\u30e9\u30b9\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.spring.main;\r\n\r\nimport org.springframework.context.annotation.Bean;\r\nimport org.springframework.context.annotation.ComponentScan;\r\nimport org.springframework.context.annotation.Configuration;\r\n\r\n@Configuration\r\n@ComponentScan(value=\"com.scdev.spring.main\")\r\npublic class MyConfiguration {\r\n\r\n\t@Bean\r\n\tpublic MyService getService(){\r\n\t\treturn new MyService();\r\n\t}\r\n}\r\n<\/code><\/pre>\n<p>Spring\u30b3\u30f3\u30c6\u30ca\u3092\u521d\u671f\u5316\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u308b\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u30af\u30e9\u30b9\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.spring.main;\r\n\r\nimport org.springframework.context.annotation.AnnotationConfigApplicationContext;\r\n\r\npublic class MyMainClass {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t\r\n\t\tAnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(\r\n\t\t\t\tMyConfiguration.class);\r\n\t\tMyService service = ctx.getBean(MyService.class);\r\n\t\t\r\n\t\tservice.log(\"Hi\");\r\n\t\t\r\n\t\tMyService newService = ctx.getBean(MyService.class);\r\n\t\tSystem.out.println(\"service hashcode=\"+service.hashCode());\r\n\t\tSystem.out.println(\"newService hashcode=\"+newService.hashCode());\r\n\t\tctx.close();\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u65e5\u672c\u8a9e\u3067\u81ea\u7136\u306b\u8a00\u3044\u63db\u3048\u308b\uff1a<\/p>\n<p>AnnotationConfigApplicationContext\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u521d\u671f\u5316\u3057\u3001getBean()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066MyService\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u53d6\u5f97\u3059\u308b\u7c21\u5358\u306a\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002MyService\u306b\u306f\u30b9\u30b3\u30fc\u30d7\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u30b7\u30f3\u30b0\u30eb\u30c8\u30f3\u3067\u3042\u308b\u306f\u305a\u3067\u3042\u308a\u3001\u305d\u306e\u305f\u3081\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30cf\u30c3\u30b7\u30e5\u30b3\u30fc\u30c9\u306f\u540c\u3058\u3067\u3042\u308b\u306f\u305a\u3067\u3059\u3002\u4e0a\u8a18\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u51fa\u529b\u304c\u8868\u793a\u3055\u308c\u3001\u79c1\u305f\u3061\u306e\u7406\u89e3\u304c\u78ba\u8a8d\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>Sat Dec 28 22:49:18 PST 2013::Hi\r\nservice hashcode=678984726\r\nnewService hashcode=678984726\r\n<\/code><\/pre>\n<p>XML\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u3092\u304a\u63a2\u3057\u3067\u3042\u308c\u3070\u3001\u307e\u305aSpring XML\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u6b21\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u30b9\u30cb\u30da\u30c3\u30c8\u3067\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u521d\u671f\u5316\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code>ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(\r\n                \"applicationContext.xml\");\r\n        MyService app = context.getBean(MyService.class);\r\n<\/code><\/pre>\n<p>\u3053\u308c\u3067\u3001Spring IoC\u306e\u4f8b\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3001Spring Bean\u306e\u30b9\u30b3\u30fc\u30d7\u3068\u8a2d\u5b9a\u306e\u8a73\u7d30\u306f\u4ee5\u4e0a\u3067\u3059\u3002Spring IoC\u3068Spring Bean\u306e\u4f8b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306f\u4ee5\u4e0b\u306e\u30ea\u30f3\u30af\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3001\u7406\u89e3\u3092\u6df1\u3081\u308b\u305f\u3081\u306b\u5b9f\u969b\u306b\u8a66\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30b9\u30d7\u30ea\u30f3\u30b0\u30d3\u30fc\u30f3\u30ba\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u304f\u3060\u3055\u3044\u3002 (Supuringu B\u012bnzu Purojekuto o daunr\u014ddo shite kudasai.)<\/p>\n<p>\u53c2\u7167\u6587\u732e\uff1aSpring.IO\u306eIOC\u30da\u30fc\u30b8<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300cSpring IoC\u306e\u30b5\u30f3\u30d7\u30eb\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3078\u3088\u3046\u3053\u305d\u3002Spring Framework\u306f\u3001\u5236\u5fa1\u306e\u53cd\u8ee2\u306e\u539f\u5247\u306b\u57fa\u3065\u3044\u3066\u69cb\u7bc9\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4f9d\u5b58\u6027\u6ce8\u5165\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306bIoC\u3092\u5b9f\u88c5\u3059\u308b\u305f\u3081\u306e\u624b\u6cd5\u3067\u3059\u3002\u300d Spring  [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[26,61],"class_list":["post-589","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-26","tag-61"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring\u306eIoC\u3001Spring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"Spring\u306eIoCSpring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/spring\u306eioc\u3001spring-bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring\u306eIoC\u3001Spring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\" \/>\n<meta property=\"og:description\" content=\"Spring\u306eIoCSpring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/spring\u306eioc\u3001spring-bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-30T02:41:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T15:52:02+00:00\" \/>\n<meta name=\"author\" content=\"\u685c, \u6625\u6a39\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u685c, \u6625\u6a39\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"28\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/\",\"name\":\"Spring\u306eIoC\u3001Spring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2023-10-30T02:41:52+00:00\",\"dateModified\":\"2025-07-31T15:52:02+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341\"},\"description\":\"Spring\u306eIoCSpring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spring\u306eIoC\u3001Spring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341\",\"name\":\"\u685c, \u6625\u6a39\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g\",\"caption\":\"\u685c, \u6625\u6a39\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/sakuraharuki\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Spring\u306eIoC\u3001Spring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb - Blog - Silicon Cloud","description":"Spring\u306eIoCSpring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/spring\u306eioc\u3001spring-bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\/","og_locale":"ja_JP","og_type":"article","og_title":"Spring\u306eIoC\u3001Spring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb","og_description":"Spring\u306eIoCSpring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/spring\u306eioc\u3001spring-bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-10-30T02:41:52+00:00","article_modified_time":"2025-07-31T15:52:02+00:00","author":"\u685c, \u6625\u6a39","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u685c, \u6625\u6a39","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"28\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/","name":"Spring\u306eIoC\u3001Spring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2023-10-30T02:41:52+00:00","dateModified":"2025-07-31T15:52:02+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341"},"description":"Spring\u306eIoCSpring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"Spring\u306eIoC\u3001Spring Bean\u306e\u4f8b\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341","name":"\u685c, \u6625\u6a39","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g","caption":"\u685c, \u6625\u6a39"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/sakuraharuki\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/spring%e3%81%aeioc%e3%80%81spring-bean%e3%81%ae%e4%be%8b%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=589"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/589\/revisions"}],"predecessor-version":[{"id":42521,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/589\/revisions\/42521"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}