GH-284 - Support for open application modules.

Application modules can now be declared as open, which causes internal components being exposed for access by other modules.
This commit is contained in:
Oliver Drotbohm
2024-02-29 12:47:10 +01:00
parent b73b4ca70a
commit f3c111f769
19 changed files with 331 additions and 22 deletions

View File

@@ -0,0 +1,29 @@
/*
* Copyright 2024 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.open.internal;
import org.springframework.stereotype.Component;
import com.acme.myproject.openclient.ClientToInternal;
/**
* @author Oliver Drotbohm
*/
@Component
public class Internal {
ClientToInternal clientToInternal;
}

View File

@@ -0,0 +1,5 @@
@ApplicationModule(type = Type.OPEN)
package com.acme.myproject.open;
import org.springframework.modulith.ApplicationModule;
import org.springframework.modulith.ApplicationModule.Type;

View File

@@ -0,0 +1,26 @@
/*
* Copyright 2024 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.openclient;
import com.acme.myproject.open.internal.Internal;
/**
* @author Oliver Drotbohm
*/
public class ClientToInternal {
Internal internal;
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright 2024 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.opendisallowedclient;
import com.acme.myproject.open.internal.Internal;
/**
* @author Oliver Drotbohm
*/
public class DisallowedClientOfInternal {
Internal internal;
}

View File

@@ -0,0 +1,2 @@
@org.springframework.modulith.ApplicationModule(allowedDependencies = "moduleA")
package com.acme.myproject.opendisallowedclient;