回答編集履歴
2
追加資料
test
CHANGED
@@ -7,3 +7,173 @@
|
|
7
7
|
の前って</bean>欲しくないですか?
|
8
8
|
|
9
9
|
その後のEntityManagerのところで<bean>始まってるのでネストしてしまうのではないかと
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
----
|
14
|
+
|
15
|
+
あまり、xmlで設定書いてないので間違ってるかもしれないですが
|
16
|
+
|
17
|
+
質問にあった xmlをフォーマットかけてみたものを下に貼ります。
|
18
|
+
|
19
|
+
やっぱりDataSourceのプロパティ当たりのネストが深い気がしますが何かの参考になるでしょうか?
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
```xml
|
24
|
+
|
25
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
26
|
+
|
27
|
+
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans
|
28
|
+
|
29
|
+
http://www.springframework.org/schema/beans/spring-beans.xsd
|
30
|
+
|
31
|
+
http://www.springframework.org/schema/jdbc
|
32
|
+
|
33
|
+
http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
34
|
+
|
35
|
+
http://www.springframework.org/schema/data/jpa
|
36
|
+
|
37
|
+
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
|
38
|
+
|
39
|
+
http://www.springframework.org/schema/tx
|
40
|
+
|
41
|
+
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
|
42
|
+
|
43
|
+
http://www.springframework.org/schema/context
|
44
|
+
|
45
|
+
http://www.springframework.org/schema/context/spring-context.xsd">
|
46
|
+
|
47
|
+
<!--
|
48
|
+
|
49
|
+
Uncomment and add your base-package here:
|
50
|
+
|
51
|
+
<context:component-scan
|
52
|
+
|
53
|
+
base-package="org.springframework.samples.service">
|
54
|
+
|
55
|
+
-->
|
56
|
+
|
57
|
+
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
58
|
+
|
59
|
+
<property name="dataSource" ref="dataSource">
|
60
|
+
|
61
|
+
<property name="packagesToScan" value="jp.ssie.helloworld.model">
|
62
|
+
|
63
|
+
<property name="jpaVendorAdapter">
|
64
|
+
|
65
|
+
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
|
66
|
+
|
67
|
+
</bean>
|
68
|
+
|
69
|
+
<property name="jpaProperties">
|
70
|
+
|
71
|
+
<props>
|
72
|
+
|
73
|
+
<prop key="hibernate.hbm2ddl.auto">
|
74
|
+
|
75
|
+
none
|
76
|
+
|
77
|
+
</prop>
|
78
|
+
|
79
|
+
<prop key="hibernate.show_sql">
|
80
|
+
|
81
|
+
true
|
82
|
+
|
83
|
+
</prop>
|
84
|
+
|
85
|
+
<prop key="hibernate.dialect">
|
86
|
+
|
87
|
+
org.hibernate.dialect.MySQLDialect
|
88
|
+
|
89
|
+
</prop>
|
90
|
+
|
91
|
+
</props>
|
92
|
+
|
93
|
+
</property>
|
94
|
+
|
95
|
+
</property>
|
96
|
+
|
97
|
+
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
|
98
|
+
|
99
|
+
<property name="driverClassName" value="${jdbc.driverClassName}">
|
100
|
+
|
101
|
+
<property name="url" value="${jdbc.url}">
|
102
|
+
|
103
|
+
<property name="username" value="${jdbc.username}">
|
104
|
+
|
105
|
+
<property name="password" value="${jdbc.password}">
|
106
|
+
|
107
|
+
<property name="removeAbandoned" value="true">
|
108
|
+
|
109
|
+
<property name="initialSize" value="3">
|
110
|
+
|
111
|
+
<property name="maxActive" value="30">
|
112
|
+
|
113
|
+
<property name="validationQuery" value="select now()">
|
114
|
+
|
115
|
+
</property>
|
116
|
+
|
117
|
+
<property-placeholder location="classpath:jdbc.properties">
|
118
|
+
|
119
|
+
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
|
120
|
+
|
121
|
+
<property name="dataSource" ref="dataSource">
|
122
|
+
|
123
|
+
</property>
|
124
|
+
|
125
|
+
<bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
|
126
|
+
|
127
|
+
<constructor-arg ref="dataSource">
|
128
|
+
|
129
|
+
</constructor-arg>
|
130
|
+
|
131
|
+
<repositories base-package="jp.ssie.helloworld.repository">
|
132
|
+
|
133
|
+
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
134
|
+
|
135
|
+
<property name="entityManagerFactory" ref="entityManagerFactory">
|
136
|
+
|
137
|
+
</property>
|
138
|
+
|
139
|
+
<annotation-driven>
|
140
|
+
|
141
|
+
</annotation-driven>
|
142
|
+
|
143
|
+
</bean>
|
144
|
+
|
145
|
+
</repositories>
|
146
|
+
|
147
|
+
</bean>
|
148
|
+
|
149
|
+
</bean>
|
150
|
+
|
151
|
+
</property-placeholder>
|
152
|
+
|
153
|
+
</property>
|
154
|
+
|
155
|
+
</property>
|
156
|
+
|
157
|
+
</property>
|
158
|
+
|
159
|
+
</property>
|
160
|
+
|
161
|
+
</property>
|
162
|
+
|
163
|
+
</property>
|
164
|
+
|
165
|
+
</property>
|
166
|
+
|
167
|
+
</bean>
|
168
|
+
|
169
|
+
</property>
|
170
|
+
|
171
|
+
</property>
|
172
|
+
|
173
|
+
</bean>
|
174
|
+
|
175
|
+
</beans>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
```
|
1
補足
test
CHANGED
@@ -5,3 +5,5 @@
|
|
5
5
|
```
|
6
6
|
|
7
7
|
の前って</bean>欲しくないですか?
|
8
|
+
|
9
|
+
その後のEntityManagerのところで<bean>始まってるのでネストしてしまうのではないかと
|