java – How do I insert a @PropertySource from a dependency?

I need to add a @PropertySource from a dependency to my test and can't find a way.

I have the dependency in pom.xml


    com.paquete
    artefacto
    ${artefacto.version}

The interior has a class:

@Configuration
@PropertySource({"classpath:properties/constants.properties"})
public class WebConstants {
    @Value("${web.constants.indexPage}")
    private String indexPage;

    public String getIndexPage() {return this.indexPage;}
}

and this is my test (especially of a controller):

import com.paquete.artefacto.subpaquete.WebConstants;

@RunWith(PowerMockRunner.class)
@PrepareForTest({otraClase1.class, otraClase2.class, otraClase3.class})
@ContextConfiguration(classes = {otraClase4.class, otraClase5.class})
@ActiveProfiles("test")
public class ControllerTest {
    private WebConstants webConstants;
    // webConstants.getIndexPage()
}

How do I cram webConstants? I tried inserting it into @ContextConfiguration, it into @Autowired or @InjectMocks, but nothing.

Thank you in advance for your help and apologize for the need to keep the names confidential.

The description of the dependency inversion principle could be simpler.

I have always seen DIP explained briefly with 2 bullets:

  • Abstractions should depend on abstractions

  • Details should depend on abstractions

And we wondered how it is different from saying "everything should depend on abstractions".
`
Do I miss something if my approach is to never be dependent on other class implementations during development?

7 – How do I set my own module dependency on a Composer package?

You can add dependencies to your module.

Navigate to the root folder of your module. Run composer init. If you come to the question Would you like to define your dependencies (require) interactively, Say yes. You can then declare any Composer libraries that your module depends on.

You can also create one manually composer.json File that looks something like this:

{
    "name": "uniquenamespace/packagename",
    "description": "This module does some stuff",
    "type": "drupal-module",
    "authors": (
        {
            "name": "Some Guy",
            "homepage": "https://www.example.com/some_guy",
            "role": "Maintainer"
        }
    ),
    "require": {
        "somevendor/somepackage": "^1.9"
    },
    "license": "    GPL-2.0-or-later"
}

Run composer validate to check if your composer.json File is valid.

Dependency relationships in MVVM and the location of the controller

I know there are many questions about it, but there is a lot of seemingly contradictory information.

My guess:
The view model is an abstraction of the view, an interface to business logic, if you like.
If the view model is an abstraction of the view, it makes sense not to depend on its implementation. The view model therefore has no view. I am assuming that the view model is a kind of proxy for the view and provides controls that can be manipulated by anyone who owns the view model. Which class does the view model have / use? The model is of course not aware of a view model, since it only contains the status of the application.
Therefore, I would like to introduce a controller that takes care of the specific business logic. Which in my opinion enables a much looser coupling.

This is how I imagine the dependency relationship:

sketch

To be more specific. How can I imagine the dependency relationship between the different components? And how much sense does the introduction of a controller (for the processing logic) make and, above all, how correct am I in my assumptions?

magento2 – Component dependency check failed

I want to install a plugin, but the readiness check shows the next error

Check the component dependency
We have found conflicting component dependencies.

    Command "require" failed:
    In RemoteFilesystem.php line 559:

    The "https://repo.magento.com/packages.json" file could not be downloaded:
    SSL operation failed with code 1. OpenSSL Error messages:
    error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify
    failed
    Failed to enable crypto
    failed to open stream: operation failed


require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [...]

I use Magento 2.3.3.

Does anyone have a solution?

Linux – Dependency on Certbot Python Augeas

Tried to start a simple LAMP service with AWS and Certbot SSL. Follow all the instructions but when I start certbot-auto the following error is displayed:

The apache plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError('Problem in Augeas installation',)

My attempts to install Python-Augeas using the following:
pip3 install python-augeas

Result:

ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv(0) = '"'"'/tmp/pip-install-27aroyjq/python-augeas/setup.py'"'"'; __file__='"'"'/tmp/pip-install-27aroyjq/python-augeas/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-27aroyjq/python-augeas/pip-egg-info
         cwd: /tmp/pip-install-27aroyjq/python-augeas/
    Complete output (31 lines):
    Traceback (most recent call last):
      File "", line 1, in 
      File "/tmp/pip-install-27aroyjq/python-augeas/setup.py", line 43, in 
        test_suite="test.test_augeas",
      File "/home/ec2-user/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib64/python3.6/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/ec2-user/.local/lib/python3.6/site-packages/setuptools/dist.py", line 448, in __init__
        k: v for k, v in attrs.items()
      File "/usr/lib64/python3.6/distutils/dist.py", line 281, in __init__
        self.finalize_options()
      File "/home/ec2-user/.local/lib/python3.6/site-packages/setuptools/dist.py", line 740, in finalize_options
        ep.load()(self)
      File "/home/ec2-user/.local/lib/python3.6/site-packages/setuptools/dist.py", line 747, in _finalize_setup_keywords
        ep.load()(self, ep.name, value)
      File "/tmp/pip-install-27aroyjq/python-augeas/.eggs/cffi-1.14.0-py3.6-linux-x86_64.egg/cffi/setuptools_ext.py", line 217, in cffi_modules
        add_cffi_module(dist, cffi_module)
      File "/tmp/pip-install-27aroyjq/python-augeas/.eggs/cffi-1.14.0-py3.6-linux-x86_64.egg/cffi/setuptools_ext.py", line 49, in add_cffi_module
        execfile(build_file_name, mod_vars)
      File "/tmp/pip-install-27aroyjq/python-augeas/.eggs/cffi-1.14.0-py3.6-linux-x86_64.egg/cffi/setuptools_ext.py", line 25, in execfile
        exec(code, glob, glob)
      File "augeas/ffi.py", line 47, in 
        lib = ffi.dlopen("augeas")
      File "/tmp/pip-install-27aroyjq/python-augeas/.eggs/cffi-1.14.0-py3.6-linux-x86_64.egg/cffi/api.py", line 150, in dlopen
        lib, function_cache = _make_ffi_library(self, name, flags)
      File "/tmp/pip-install-27aroyjq/python-augeas/.eggs/cffi-1.14.0-py3.6-linux-x86_64.egg/cffi/api.py", line 832, in _make_ffi_library
        backendlib = _load_backend_lib(backend, libname, flags)
      File "/tmp/pip-install-27aroyjq/python-augeas/.eggs/cffi-1.14.0-py3.6-linux-x86_64.egg/cffi/api.py", line 827, in _load_backend_lib
        raise OSError(msg)
    OSError: ctypes.util.find_library() did not manage to locate a library called 'augeas'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Does anyone have any ideas?

Kotlin – Intellij IDEA project dependency error

I followed this guide to set up a two-line project with the intention of playing around with the following class:

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-pair/index.html

I can instantiate a pair object val testPair = Pair(1,2) and then call println(testPair) (1,2) to be displayed as output in the console.

However, when I try to access one of the parameters or functions of Pair (first. second. toString())

Intellij cannot create my project with the following error message:

Error:Kotlin: Supertypes of the following classes cannot be resolved. 
Please make sure you have the required dependencies in the classpath:
    class kotlin.Pair, unresolved supertypes: java.io.Serializable

Here's a look at my project structure: https://thumbs.gfycat.com/BrightRawKiskadee-mobile.mp4

How can I solve the addiction problem?

text – An efficient way to extract dependency strings from a sentence

Mathematica has the built-in TextStructure function with the DependencyStrings option, which provides the dependency strings of a sentence. Unfortunately, this function is incredibly slow.

 Timing@TextStructure("He wrote a book. I read the book he wrote.", 
  "DependencyStrings", PerformanceGoal -> "Speed")
{0.59375, {"(wrote, 2)((nsubj, (He, 1)), (dobj, (book, 4)((det, (a, 
3)))))", "(read, 2)((nsubj, (I, 1)), (dobj, (book, 4)((det, (the, 
3)), (rcmod, (wrote, 6)((nsubj, (he, 5)))))))"}}

As can be seen in the example above, two sets last 0.6 seconds. Can someone speed it up or is there an alternative since the goal is to use it for the data set with more than 15,000 observations?

Architecture – Is there a way to generate a dependency graph of my microservices?

I have a general question, nothing special.

I was wondering whether there is a tool or a method that can be used to call up all dependencies of a micro-service architecture. I've researched online, but some tools that I find are strictly tied to a specific framework, mostly Spring Boot.

Is there a general method (a way, a tool) to do this regardless of your programming language or the framework used to create your micro services? Something you would do on your back-end that would generate a diagram of all of your micro services showing which micro service uses which local and remote other services?