Browsed by
Category: Spring Boot

Creating a SOAP web service with Spring Boot

Creating a SOAP web service with Spring Boot

Creating a SOAP web service with Spring Boot Main Application Spring Boot File: package com.ngdeveloper; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class CouponApplication { public static void main(String[] args) { SpringApplication.run(CouponApplication.class, args); } } pom.xml file: This below pom.xml file contains the plugin to generate the output directory files from the xsd file, so create the pom.xml, xsd file, endpoints then by starting your spring boot application you will be able to find the other required files generated. These are…

Read More Read More

857 total views, 4 views today

2 ways to refer classpath resource in spring boot projects

2 ways to refer classpath resource in spring boot projects

2 ways to refer classpath resource in spring boot projects   Using ClasspathResource import org.springframework.core.io.ClassPathResource; @Bean public XsdSchema mySchema() { return new SimpleXsdSchema(new ClassPathResource("myfile.xsd")); }   Note: Here myfile.xsd should be located in src/main/resources. Using Resource import org.springframework.core.io.Resource; @Value("classpath:myfile.xsd") private Resource res; @Bean public XsdSchema mySchema() { return new SimpleXsdSchema(res); } 747 total views, 2 views today

747 total views, 2 views today

How to create a Simple RabbitMQ listener in Spring boot ?

How to create a Simple RabbitMQ listener in Spring boot ?

How to create a Simple RabbitMQ listener in Spring boot ?   We are going to create a simple rabbitmq listener in the same spring boot project, but general usecase would be to use rabbitmq is between different microservices / different spring boot projects. This is to make a understanding of how to use rabbitmq and what are all things we need to do for a rabbitmq connectivity.   Prerequisite: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-amqp</artifactId> </dependency> Step 1: Declare a queue name…

Read More Read More

728 total views, 2 views today

Spring Boot Tutorials

Spring Boot Tutorials

Spring Boot Tutorials: 1. Spring Boot – Is it a Brand New Framework ? Spring boot is not a brand new framework, just like mvc/web/rest/jpa add-ons, it’s just a additional kit from spring to reduce the development headaches with spring framework.   2. How to configure spring boot in Maven ? Spring boot provides single dependency entry for pom.xml configuration, [code language=”xml”] <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.10.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> [/code] Here this downloads all the dependencies…

Read More Read More

1,663 total views, 10 views today

Scheduler in Spring Boot with 3 Simple Steps Example

Scheduler in Spring Boot with 3 Simple Steps Example

Scheduler in Spring Boot with 3 Simple Steps Example: Scheduler in spring boot became very simple and any one create a Cron job or scheduler in spring boot with just 3 steps. Step 1: Enable spring boot for schedules Add @EnableScheduling to your spring boot main class. @SpringBootApplication @EnableScheduling public class SpringBootStarter{ public static void main(String[] args) { SpringApplication.run(SpringBootStarter.class, args); } } Step 2: Create a cron job component: import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @Component public class CronJobSchedules…

Read More Read More

889 total views, no views today