##Classic Hello World println "Hello World" println "Hello World 2"
//for loop def value = { println it } 1.upto(5,value) //alternative to above for loop
##Classic Hello World println "Hello World" println "Hello World 2"
//for loop def value = { println it } 1.upto(5,value) //alternative to above for loop
@EnableAutoConfiguration | |
@ComponentScan | |
@Configuration | |
public class Application{ | |
//main method | |
} |
public class Order { | |
@NotBlank(groups = {ValidationCheckOrder.class}) | |
private String orderId; | |
@Email(groups = {ValidationCheckEmail.class}) | |
@NotBlank(groups = {ValidationCheckEmail.class}) | |
private String email; | |
} |
<dependency> | |
<groupId>com.alibaba.csp</groupId> | |
<artifactId>sentinel-annotation-aspectj</artifactId> | |
<version>1.8.0</version> | |
</dependency> | |
<dependency> | |
<groupId>com.alibaba.csp</groupId> | |
<artifactId>sentinel-core</artifactId> | |
<version>1.8.0</version> | |
</dependency> |
@Service | |
public class TestService { | |
@SentinelResource(value = "getResponseFromFallback", fallback = "fallbackTestMethod", defaultFallback = "defaultFallback") | |
public String getResponseFromFallback(int i) { | |
if (i == 0) { | |
throw new IllegalArgumentException("Error occurred"); | |
} | |
return "success"; | |
} |
@Configuration | |
public class TestConfiguration { | |
@Bean | |
public SentinelResourceAspect sentinelResourceAspect() { | |
return new SentinelResourceAspect(); | |
} | |
} |
@Configuration | |
public class TestConfiguration { | |
@Bean | |
public SentinelResourceAspect sentinelResourceAspect() { | |
return new SentinelResourceAspect(); | |
} | |
@PostConstruct | |
public void init() { |
@EnableEurekaServer | |
@SpringBootApplication | |
public class EurekaServerApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(EurekaServerApplication.class, args); | |
} | |
} |
server: | |
port: 8761 #default port where discovery client is registered | |
eureka: | |
client: | |
registerWithEureka: false | |
fetchRegistry: false | |
server: | |
waitTimeInMsWhenSyncEmpty: 0 |
client: | |
serviceUrl: | |
defaultZone: http://127.0.0.1:8761/eureka/ #eureka endpoint |