Connect Service to Component - Auto Configuration
🕓 5 minutes
#
What you’ll learnHow to add new services such as Kafka or Redis to your component, so that CodeNow will automatically generate the configuration and connect your component to the chosen service during deployment.
Auto-configuration generates files to your repository, so you don't have to write them yourself. It also adds the required dependencies to the pom.xml file.
#
Prerequisites- You want to create a new application component using Java Spring Boot scaffolder and want to auto-configure services.
- Choose the existing application or Create a New Application.
- Create New Service (e.g. Apache Kafka)
#
StepWhile creating a new Spring Boot component, click on the "Add new connection" button and choose one of the services.
You can choose from:
Tick the "Configure your component automatically" box.
Select your service instance and click the "Confirm" button.
NOTE: You can't generate the configuration after your component is created. If your component already exists, see Manual Service Configuration.
After you've created a component, you can see your generated configuration in the project source code inside the src/main/java/com/codenow/generated package.
Please refrain from editing these files yourself as they may be changed or re-generated in the future.
Auto-configuration also adds the required dependencies to pom.xml and enables autoconfiguration in src/main/resources/META-INF/spring.factories.
You can go to the component details and click "Connection Usage" to see the instructions and generated files names and locations.
When your application will be ready for deployment, you will be able to select a specific service instance for every environment and CodeNow will automatically provide your application with the correct values so that your component will be connected to a chosen service.
- For more information, see the Application deployment tutorial.
#
ScreenshotStep 1.1

Step 1.2

Step 1.3

Step 2.1

Step 2.2

Example instructions for Apache Kafka.

#
What’s next?See our other manuals: