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:
@@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@ApplicationModule(allowedDependencies = "complex::API")
|
||||
package com.acme.myproject.invalid3;
|
||||
|
||||
import org.springframework.modulith.ApplicationModule;
|
||||
Reference in New Issue
Block a user