GH-36 - Better dependency verification for named interfaces.

We now verify detected dependencies against optionally explicitly defined ones. Those can refer to named interfaces (via the "moduleName :: namedInterfaceName" syntax). If such an allowed dependency is defined, all dependencies towards other named interfaces (also the unnamed one) are rejected.

Some Javadoc polishing.
This commit is contained in:
Oliver Drotbohm
2022-08-09 16:04:22 +02:00
parent fb23c452cd
commit 7e890fd705
12 changed files with 270 additions and 73 deletions

View File

@@ -0,0 +1,34 @@
/*
* Copyright 2018-2022 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
*
* https://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 com.acme.myproject.invalid3;
import com.acme.myproject.complex.spi.ComplexSpiComponent;
/**
* @author Oliver Drotbohm
*/
public class InvalidModuleDependency {
/**
* The dependency is invalid as the module declaration only allows dependencies to the named interface API within the
* complex module.
*
* @param dependency
*/
public InvalidModuleDependency(ComplexSpiComponent dependency) {
}
}

View File

@@ -0,0 +1,4 @@
@ApplicationModule(allowedDependencies = "complex::API")
package com.acme.myproject.invalid3;
import org.springframework.modulith.ApplicationModule;