Colega,
Tenho uma app que funciona com o spring. Dai resolví usar o spring security e para tanto acrescentei no applicationContext.xml(abaixo) as linhas:
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd"
//e
<!-- Configuracao do Spring Security -->
<http auto-config="true">
<form-login login-page="/login.xhtml"
authentication-failure-url="/login.xhtml?error=true" />
<logout logout-success-url="/login.xhtml" />
<intercept-url pattern="/index.xhtml" access="ROLE_USER" />
</http>
<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="SELECT username, password, enable FROM User WHERE username=?"
authorities-by-username-query="SELECT User_username AS username, Auth_authority AS authority FROM User_Auth WHERE User_username=?" />
</authentication-provider>
</authentication-manager>
Dai, na tag aparece o erro:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'http'. One of '{"http://www.springframework.org/schema/beans":description, "http://www.springframework.org/schema/
beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, WC[##other:"http://www.springframework.org/schema/beans"]}' is
expected.
Como declarar o que falta, se é que falta?
Muito obrigado,
Marques
<?xml version="1.0" encoding="UTF-8"?>
<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:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<!-- Configuracao do Spring Security -->
<http auto-config="true">
<form-login login-page="/login.xhtml"
authentication-failure-url="/login.xhtml?error=true" />
<logout logout-success-url="/login.xhtml" />
<intercept-url pattern="/index.xhtml" access="ROLE_USER" />
</http>
<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="SELECT username, password, enable FROM User WHERE username=?"
authorities-by-username-query="SELECT User_username AS username, Auth_authority AS authority FROM User_Auth WHERE User_username=?" />
</authentication-provider>
</authentication-manager>
<!-- Seta anotaçoes para serem usadas pelo Spring -->
<context:annotation-config />
<!-- Define o pacote onde o Spring vai procurar por beans anotados -->
<context:component-scan
base-package="br.com.fit.fitathena.service,br.com.fit.fitathena.dao" />
<!-- define que as transaçoes irao ser anotadas -->
<tx:annotation-driven />
<!-- Configuracao do Banco de Dados -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/fitathena" />
<property name="username" value="root" />
<property name="password" value="secreta" />
</bean>
<!-- Configuracao do Hibernate -->
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="fitathenaPU" />
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" />
<property name="showSql" value="true" />
</bean>
</property>
</bean>
<!-- Configuracao do gerente de transacoes do Spring -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
</beans>