security-context.xmlにてログイン認証で使用するJdbcTemplateを使いまわしたい
security-context.xmlにてログイン認証で使用するJdbcTemplateを使いまわしたいのですが、deploy中に「nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.jdbc.core.JdbcTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
」とのメッセージが出てしまう。
設定ファイいるの一式(security-contexst.xml等)を見せてください。
<http auto-config="true" > <!-- 認可の設定 --> <intercept-url pattern="/top*" access="hasAnyRole('ROLE_ADMIN')" /> <intercept-url pattern="/admin*" access="hasRole('ROLE_ADMIN')" /> <intercept-url pattern="/list*" access="hasRole('ROLE_ADMIN')" /> <intercept-url pattern="/detail*" access="hasRole('ROLE_ADMIN')" /> <intercept-url pattern="/user*" access="hasRole('ROLE_USER')" /> <!-- 権限なし時の遷移先 --> <access-denied-handler error-page="/403" /> <!-- 認証のログイン処理 --> <form-login login-page="/" default-target-url="/top" authentication-failure-url="/error" login-processing-url="/j_spring_security_check"/> <!-- 認証のログアウト処理 --> <logout logout-url="/logout" logout-success-url="/" invalidate-session="true"/> <!-- anonymousユーザのROLE --> <anonymous granted-authority="ROLE_ANONYMOUS" /> </http> <beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" > <beans:property name="driverClassName" value="org.gjt.mm.mysql.Driver" /> <beans:property name="url" value="jdbc:mysql://127.0.0.1:3306/tododb" /> <beans:property name="username" value="root" /> <beans:property name="password" value="Manabu2010" /> </beans:bean> <authentication-manager alias="authenticationManager"> <authentication-provider> <!-- SQLでユーザ情報取得 --> <jdbc-user-service data-source-ref="dataSource" users-by-username-query=" select name as username, password as password, true as enabled from users where name=?" authorities-by-username-query=" select name as username, authority as authority from users where name=?"/> </authentication-provider> </authentication-manager> </beans:beans>
こんな感じです。
これがsecurity-context.xmlの中身です。
できれば、一式を見せていただきたいです。security-context.xmlだけだと原因を追うのは難しいです。また、質問に追記する形で書いていただけるとありがたいです。
念のため pom.xmlも提示してください
あなたの回答
tips
プレビュー