Merge pull request #8125 from eugenp/revert-8119-BAEL-3275-2

Revert "BAEL-3275: Using blocking queue for pub-sub"
This commit is contained in:
Eric Martin
2019-10-31 20:43:47 -05:00
committed by GitHub
parent db85c8f275
commit 3225470df5
20543 changed files with 1642750 additions and 0 deletions
@@ -0,0 +1,11 @@
package com.baeldung.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
@Configuration
@EnableScheduling
@ComponentScan("com.baeldung.scheduled")
public class ScheduledConfig {
}
@@ -0,0 +1,17 @@
package com.baeldung.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import javax.servlet.ServletContext;
@EnableWebMvc
@Configuration
@ComponentScan(basePackages = {"com.baeldung.controller.parameterized"})
public class WebConfig {
@Autowired
private ServletContext ctx;
}
@@ -0,0 +1,32 @@
package com.baeldung.controller.parameterized;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.Map;
@Controller
public class EmployeeRoleController {
private static Map<String, Role> userRoleCache = new HashMap<>();
static {
userRoleCache.put("John", Role.ADMIN);
userRoleCache.put("Doe", Role.EMPLOYEE);
}
@RequestMapping(value = "/role/{name}", method = RequestMethod.GET, produces = "application/text")
@ResponseBody
public String getEmployeeRole(@PathVariable("name") String employeeName) {
return userRoleCache.get(employeeName).toString();
}
private enum Role {
ADMIN, EMPLOYEE
}
}
@@ -0,0 +1,13 @@
package com.baeldung.dirtiescontext;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringDataRestApplication {
public static void main(String[] args) {
SpringApplication.run(SpringDataRestApplication.class, args);
}
}
@@ -0,0 +1,9 @@
package com.baeldung.dirtiescontext;
public class User {
String firstName;
String lastName;
}
@@ -0,0 +1,28 @@
package com.baeldung.dirtiescontext;
import java.util.HashSet;
import java.util.Set;
import org.springframework.stereotype.Component;
import lombok.Getter;
@Component
public class UserCache {
@Getter
private Set<String> userList = new HashSet<>();
public boolean addUser(String user) {
return userList.add(user);
}
public boolean removeUser(String user) {
return userList.remove(user);
}
public void printUserList(String message) {
System.out.println(message + ": " + userList);
}
}
@@ -0,0 +1,11 @@
package com.baeldung.overrideproperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
@@ -0,0 +1,24 @@
package com.baeldung.overrideproperties.resolver;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class PropertySourceResolver {
private final String firstProperty;
private final String secondProperty;
public PropertySourceResolver(@Value("${example.firstProperty}") String firstProperty, @Value("${example.secondProperty}") String secondProperty) {
this.firstProperty = firstProperty;
this.secondProperty = secondProperty;
}
public String getFirstProperty() {
return firstProperty;
}
public String getSecondProperty() {
return secondProperty;
}
}
@@ -0,0 +1,20 @@
package com.baeldung.scheduled;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.concurrent.atomic.AtomicInteger;
@Component
public class Counter {
private final AtomicInteger count = new AtomicInteger(0);
@Scheduled(fixedDelay = 5)
public void scheduled() {
this.count.incrementAndGet();
}
public int getInvocationCount() {
return this.count.get();
}
}
@@ -0,0 +1,10 @@
package com.baeldung.testexecutionlisteners;
import org.springframework.stereotype.Service;
@Service
public class AdditionService {
public int add(int a, int b) {
return a + b;
}
}
@@ -0,0 +1,15 @@
package com.baeldung.testpropertysource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class ClassUsingProperty {
@Value("${baeldung.testpropertysource.one}")
private String propertyOne;
public String retrievePropertyOne() {
return propertyOne;
}
}