DATALDAP-1 - Create namespace handler and XML schema.

Spring Data LDAP now uses its own Namespace: http://www.springframework.org/schema/data/ldap. Using XML configuration for Spring LDAP and Spring Data LDAP requires both namespaces to be declared.

<beans xmlns="http://www.springframework.org/schema/beans"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns:ldap="http://www.springframework.org/schema/ldap"
		xmlns:data-ldap="http://www.springframework.org/schema/data/ldap"
		xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd
		http://www.springframework.org/schema/data/ldap http://www.springframework.org/schema/data/ldap/spring-ldap.xsd">

	<ldap:context-source password="apassword" url="ldap://localhost:389" username="uid=admin"/>

	<ldap:ldap-template/>

	<data-ldap:repositories base-package="org.springframework.data.ldap.config"/>

</beans>
This commit is contained in:
Mark Paluch
2016-12-06 10:12:45 +01:00
parent 864725367a
commit 39b6b4d6af
8 changed files with 181 additions and 4 deletions

View File

@@ -0,0 +1,44 @@
/*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.ldap.config;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Unit test for {@link LdapNamespaceHandler}.
*
* @author Mark Paluch
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class LdapNamespaceHandlerTests {
@Autowired private ApplicationContext context;
@Test // DATALDAP-1
public void shouldCreateRepository() {
assertThat(context.getBean(DummyLdapRepository.class), is(notNullValue()));
}
}