completions, Class> requiredType,
+ String existingData, String optionContext, MethodTarget target) {
+ return false;
+ }
+
+ @Override
+ public boolean supports(Class> requiredType, String optionContext) {
+ return URL.class.isAssignableFrom(requiredType);
+ }
+
+}
diff --git a/spring-all/src/main/resources/META-INF/spring/spring-shell-plugin.xml b/spring-all/src/main/resources/META-INF/spring/spring-shell-plugin.xml
new file mode 100644
index 0000000000..aea1a663c1
--- /dev/null
+++ b/spring-all/src/main/resources/META-INF/spring/spring-shell-plugin.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-all/src/test/java/org/baeldung/shell/simple/SimpleCLIUnitTest.java b/spring-all/src/test/java/org/baeldung/shell/simple/SimpleCLIUnitTest.java
new file mode 100644
index 0000000000..0353083943
--- /dev/null
+++ b/spring-all/src/test/java/org/baeldung/shell/simple/SimpleCLIUnitTest.java
@@ -0,0 +1,86 @@
+package org.baeldung.shell.simple;
+
+import java.io.File;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.springframework.shell.Bootstrap;
+import org.springframework.shell.core.CommandResult;
+import org.springframework.shell.core.JLineShellComponent;
+
+public class SimpleCLIUnitTest {
+
+ static JLineShellComponent shell;
+
+ @BeforeClass
+ public static void startUp() throws InterruptedException {
+ Bootstrap bootstrap = new Bootstrap();
+ shell = bootstrap.getJLineShellComponent();
+ }
+
+ @AfterClass
+ public static void shutdown() {
+ shell.stop();
+ }
+
+ public static JLineShellComponent getShell() {
+ return shell;
+ }
+
+ @Test
+ public void givenCommandConfig_whenExecutingWebGetCommand_thenCorrectResult() {
+
+ CommandResult resultWebSave = shell.executeCommand("web-get --url https://www.google.com");
+
+ Assert.assertTrue(resultWebSave.isSuccess());
+ }
+
+ @Test
+ public void givenCommandConfig_whenExecutingWebSaveCommand_thenCorrectResult() {
+
+ shell.executeCommand("admin-enable");
+ CommandResult result = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
+
+ Assert.assertArrayEquals(
+ new boolean[]{
+ result.isSuccess(),
+ new File("contents.txt").exists()},
+ new boolean[]{true, true});
+ }
+
+ @Test
+ public void givenCommandConfig_whenAdminEnableCommandExecuted_thenCorrectAvailability() {
+
+ CommandResult resultAdminDisable = shell.executeCommand("admin-disable");
+ CommandResult resultWebSaveUnavailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
+ CommandResult resultAdminEnable = shell.executeCommand("admin-enable");
+ CommandResult resultWebSaveAvailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
+
+ Assert.assertArrayEquals(
+ new boolean[]{
+ resultAdminDisable.isSuccess(),
+ resultWebSaveUnavailable.isSuccess(),
+ resultAdminEnable.isSuccess(),
+ resultWebSaveAvailable.isSuccess()},
+ new boolean[]{true, false, true, true});
+ }
+
+ @Test
+ public void givenCommandConfig_whenWebSaveCommandExecutedNoOutArgument_thenError() {
+
+ shell.executeCommand("admin-enable");
+ CommandResult resultWebSave = shell.executeCommand("web-save --url https://www.google.com");
+
+ Assert.assertEquals(resultWebSave.isSuccess(), false);
+ }
+
+ @Test
+ public void givenCommandConfig_whenExecutingWebGetCommandWithDefaultArgument_thenCorrectResult() {
+
+ CommandResult result = shell.executeCommand("web-get https://www.google.com");
+
+ Assert.assertEquals(result.isSuccess(), true);
+ }
+
+}
diff --git a/spring-boot-auditing/.gitignore b/spring-boot-auditing/.gitignore
deleted file mode 100644
index 31ce405488..0000000000
--- a/spring-boot-auditing/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-/target/
-.settings/
-.classpath
-.project
-*.iml
-.idea
\ No newline at end of file
diff --git a/spring-boot-auditing/pom.xml b/spring-boot-auditing/pom.xml
deleted file mode 100644
index 0afbe0becc..0000000000
--- a/spring-boot-auditing/pom.xml
+++ /dev/null
@@ -1,198 +0,0 @@
-
- 4.0.0
- com.baeldung
- spring-boot-auditing
- 0.0.1-SNAPSHOT
- war
- spring-boot-auditing
- This is simple boot application for Spring boot auditing test
-
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.2.RELEASE
-
-
-
-
-
- org.springframework.boot
- spring-boot-starter-thymeleaf
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
-
- org.springframework.boot
- spring-boot-starter-security
-
-
-
- io.dropwizard.metrics
- metrics-core
-
-
-
- com.h2database
- h2
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.springframework.boot
- spring-boot-starter
-
-
- com.jayway.jsonpath
- json-path
- test
-
-
- org.springframework.boot
- spring-boot-starter-mail
-
-
- org.subethamail
- subethasmtp
- ${subethasmtp.version}
- test
-
-
-
- org.webjars
- bootstrap
- ${bootstrap.version}
-
-
- org.webjars
- jquery
- ${jquery.version}
-
-
-
- org.apache.tomcat
- tomcat-servlet-api
- ${tomee-servlet-api.version}
- provided
-
-
-
-
-
- spring-boot
-
-
- src/main/resources
- true
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- 1.8
-
-
-
-
- org.apache.maven.plugins
- maven-war-plugin
-
-
-
- pl.project13.maven
- git-commit-id-plugin
- ${git-commit-id-plugin.version}
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- **/*IntegrationTest.java
- **/*LiveTest.java
-
-
-
-
-
-
-
-
-
-
- integration
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- integration-test
-
- test
-
-
-
- **/*LiveTest.java
-
-
- **/*IntegrationTest.java
-
-
-
-
-
-
- json
-
-
-
-
-
-
-
-
-
-
- UTF-8
- 1.8
- 4.3.7.RELEASE
- 2.2.1
- 3.1.1
- 3.3.7-1
- 3.1.7
- 8.5.11
-
-
-
diff --git a/spring-boot-auditing/src/main/java/org/baeldung/Application.java b/spring-boot-auditing/src/main/java/org/baeldung/Application.java
deleted file mode 100755
index bf7b7bd1a6..0000000000
--- a/spring-boot-auditing/src/main/java/org/baeldung/Application.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.baeldung;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class Application {
-
- public static void main(String[] args) throws Throwable {
- SpringApplication.run(Application.class, args);
- }
-
-}
diff --git a/spring-boot-auditing/src/main/java/org/baeldung/MvcConfig.java b/spring-boot-auditing/src/main/java/org/baeldung/MvcConfig.java
deleted file mode 100755
index fecb8c5c0b..0000000000
--- a/spring-boot-auditing/src/main/java/org/baeldung/MvcConfig.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.baeldung;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-
-@Configuration
-public class MvcConfig extends WebMvcConfigurerAdapter {
-
- @Override
- public void addViewControllers(ViewControllerRegistry registry) {
- registry.addViewController("/home").setViewName("home");
- registry.addViewController("/").setViewName("home");
- registry.addViewController("/hello").setViewName("hello");
- registry.addViewController("/login").setViewName("login");
- }
-
-}
diff --git a/spring-boot-auditing/src/main/java/org/baeldung/WebSecurityConfig.java b/spring-boot-auditing/src/main/java/org/baeldung/WebSecurityConfig.java
deleted file mode 100755
index 9339d8e804..0000000000
--- a/spring-boot-auditing/src/main/java/org/baeldung/WebSecurityConfig.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.baeldung;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-
-@Configuration
-@EnableWebSecurity
-public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http
- .authorizeRequests()
- .antMatchers("/", "/home").permitAll()
- .anyRequest().authenticated()
- .and()
- .formLogin()
- .loginPage("/login")
- .permitAll()
- .and()
- .logout()
- .permitAll();
- }
-
- @Autowired
- public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
- auth
- .inMemoryAuthentication()
- .withUser("user").password("password").roles("USER", "ACTUATOR");
- }
-}
diff --git a/spring-boot-auditing/src/main/resources/application.properties b/spring-boot-auditing/src/main/resources/application.properties
deleted file mode 100644
index cf09473b60..0000000000
--- a/spring-boot-auditing/src/main/resources/application.properties
+++ /dev/null
@@ -1 +0,0 @@
-logging.level.org.springframework=INFO
\ No newline at end of file
diff --git a/spring-boot-auditing/src/main/resources/logback.xml b/spring-boot-auditing/src/main/resources/logback.xml
deleted file mode 100644
index 78913ee76f..0000000000
--- a/spring-boot-auditing/src/main/resources/logback.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- web - %date [%thread] %-5level %logger{36} - %message%n
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/spring-boot-auditing/src/main/resources/templates/hello.html b/spring-boot-auditing/src/main/resources/templates/hello.html
deleted file mode 100755
index 46feef7e2c..0000000000
--- a/spring-boot-auditing/src/main/resources/templates/hello.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- Hello World!
-
-
- Hello [[${#httpServletRequest.remoteUser}]]!
-
-
-
\ No newline at end of file
diff --git a/spring-boot-auditing/src/main/resources/templates/home.html b/spring-boot-auditing/src/main/resources/templates/home.html
deleted file mode 100755
index fe4e8b337e..0000000000
--- a/spring-boot-auditing/src/main/resources/templates/home.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
- Spring Security Example
-
-
- Welcome!
-
- Click here to see a greeting.
-
-
\ No newline at end of file
diff --git a/spring-boot-auditing/src/main/resources/templates/login.html b/spring-boot-auditing/src/main/resources/templates/login.html
deleted file mode 100755
index a1785313f5..0000000000
--- a/spring-boot-auditing/src/main/resources/templates/login.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- Spring Security Example
-
-
-
- Invalid username and password.
-
-
- You have been logged out.
-
-
-
-
\ No newline at end of file
diff --git a/spring-security-core/pom.xml b/spring-security-core/pom.xml
index a8ffce84b7..971f5a9d0f 100644
--- a/spring-security-core/pom.xml
+++ b/spring-security-core/pom.xml
@@ -32,6 +32,10 @@
org.springframework.boot
spring-boot-starter-thymeleaf
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
com.h2database
h2
diff --git a/spring-boot-auditing/src/main/java/org/baeldung/auditing/ExposeAttemptedPathAuthorizationAuditListener.java b/spring-security-core/src/main/java/org/baeldung/auditing/ExposeAttemptedPathAuthorizationAuditListener.java
similarity index 100%
rename from spring-boot-auditing/src/main/java/org/baeldung/auditing/ExposeAttemptedPathAuthorizationAuditListener.java
rename to spring-security-core/src/main/java/org/baeldung/auditing/ExposeAttemptedPathAuthorizationAuditListener.java
diff --git a/spring-boot-auditing/src/main/java/org/baeldung/auditing/LoginAttemptsLogger.java b/spring-security-core/src/main/java/org/baeldung/auditing/LoginAttemptsLogger.java
similarity index 72%
rename from spring-boot-auditing/src/main/java/org/baeldung/auditing/LoginAttemptsLogger.java
rename to spring-security-core/src/main/java/org/baeldung/auditing/LoginAttemptsLogger.java
index 5be8cebfd3..bf0781bced 100644
--- a/spring-boot-auditing/src/main/java/org/baeldung/auditing/LoginAttemptsLogger.java
+++ b/spring-security-core/src/main/java/org/baeldung/auditing/LoginAttemptsLogger.java
@@ -15,11 +15,11 @@ public class LoginAttemptsLogger {
@EventListener
public void auditEventHappened(AuditApplicationEvent auditApplicationEvent) {
AuditEvent auditEvent = auditApplicationEvent.getAuditEvent();
- LOGGER.debug("Principal " + auditEvent.getPrincipal() + " - " + auditEvent.getType());
+ LOGGER.info("Principal " + auditEvent.getPrincipal() + " - " + auditEvent.getType());
WebAuthenticationDetails details = (WebAuthenticationDetails) auditEvent.getData().get("details");
- LOGGER.debug(" Remote IP address: " + details.getRemoteAddress());
- LOGGER.debug(" Session Id: " + details.getSessionId());
- LOGGER.debug(" Request URL: " + auditEvent.getData().get("requestUrl"));
+ LOGGER.info(" Remote IP address: " + details.getRemoteAddress());
+ LOGGER.info(" Session Id: " + details.getSessionId());
+ LOGGER.info(" Request URL: " + auditEvent.getData().get("requestUrl"));
}
}
diff --git a/spring-security-core/src/main/java/org/baeldung/config/WebSecurityConfig.java b/spring-security-core/src/main/java/org/baeldung/config/WebSecurityConfig.java
index 5441dac7f7..0b6cd34f3e 100644
--- a/spring-security-core/src/main/java/org/baeldung/config/WebSecurityConfig.java
+++ b/spring-security-core/src/main/java/org/baeldung/config/WebSecurityConfig.java
@@ -20,6 +20,9 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
- auth.inMemoryAuthentication().withUser("jim").password("jim").roles("USER").and().withUser("pam").password("pam").roles("USER").and().withUser("michael").password("michael").roles("MANAGER");
+ auth.inMemoryAuthentication()
+ .withUser("jim").password("jim").roles("USER", "ACTUATOR")
+ .and().withUser("pam").password("pam").roles("USER")
+ .and().withUser("michael").password("michael").roles("MANAGER");
}
}
diff --git a/spring-state-machine/src/main/java/com/baeldung/spring/statemachine/config/SimpleStateMachineConfiguration.java b/spring-state-machine/src/main/java/com/baeldung/spring/statemachine/config/SimpleStateMachineConfiguration.java
index f6c7991cf6..d1b1ce001c 100644
--- a/spring-state-machine/src/main/java/com/baeldung/spring/statemachine/config/SimpleStateMachineConfiguration.java
+++ b/spring-state-machine/src/main/java/com/baeldung/spring/statemachine/config/SimpleStateMachineConfiguration.java
@@ -1,9 +1,5 @@
package com.baeldung.spring.statemachine.config;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.logging.Logger;
-
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.statemachine.action.Action;
@@ -14,6 +10,10 @@ import org.springframework.statemachine.config.builders.StateMachineStateConfigu
import org.springframework.statemachine.config.builders.StateMachineTransitionConfigurer;
import org.springframework.statemachine.guard.Guard;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.logging.Logger;
+
@Configuration
@EnableStateMachine
public class SimpleStateMachineConfiguration extends StateMachineConfigurerAdapter {
@@ -21,94 +21,126 @@ public class SimpleStateMachineConfiguration extends StateMachineConfigurerAdapt
public static final Logger LOGGER = Logger.getLogger(SimpleStateMachineConfiguration.class.getName());
@Override
- public void configure(StateMachineConfigurationConfigurer config)
- throws Exception {
+ public void configure(StateMachineConfigurationConfigurer config) throws Exception {
config
- .withConfiguration()
- .autoStartup(true)
- .listener(new StateMachineListener());
+ .withConfiguration()
+ .autoStartup(true)
+ .listener(new StateMachineListener());
}
@Override
public void configure(StateMachineStateConfigurer states) throws Exception {
states
- .withStates()
- .initial("SI")
- .end("SF")
- .states(new HashSet<>(Arrays.asList("S1", "S2")))
- .stateEntry("S3", entryAction())
- .stateExit("S3", exitAction())
- .state("S4", executeAction(), errorAction())
- .stateDo("S5", executeAction());
+ .withStates()
+ .initial("SI")
+ .end("SF")
+ .states(new HashSet<>(Arrays.asList("S1", "S2")))
+ .stateEntry("S3", entryAction())
+ .stateExit("S3", exitAction())
+ .state("S4", executeAction(), errorAction())
+ .stateDo("S5", executeAction());
}
@Override
public void configure(StateMachineTransitionConfigurer transitions) throws Exception {
- transitions.withExternal()
- .source("SI").target("S1").event("E1").action(initAction())
- .and().withExternal()
- .source("S1").target("S2").event("E2")
- .and().withExternal()
- .source("SI").target("S3").event("E3")
- .and().withExternal()
- .source("S3").target("S4").event("E4")
- .and().withExternal()
- .source("S4").target("S5").event("E5")
- .and().withExternal()
- .source("S5").target("SF").event("end").guard(simpleGuard());
+ transitions
+ .withExternal()
+ .source("SI")
+ .target("S1")
+ .event("E1")
+ .action(initAction())
+ .and()
+ .withExternal()
+ .source("S1")
+ .target("S2")
+ .event("E2")
+ .and()
+ .withExternal()
+ .source("SI")
+ .target("S3")
+ .event("E3")
+ .and()
+ .withExternal()
+ .source("S3")
+ .target("S4")
+ .event("E4")
+ .and()
+ .withExternal()
+ .source("S4")
+ .target("S5")
+ .event("E5")
+ .and()
+ .withExternal()
+ .source("S5")
+ .target("SF")
+ .event("end")
+ .guard(simpleGuard());
}
@Bean
public Guard simpleGuard() {
return (ctx) -> {
- int approvalCount = (int) ctx.getExtendedState().getVariables().getOrDefault("approvalCount", 0);
+ int approvalCount = (int) ctx
+ .getExtendedState()
+ .getVariables()
+ .getOrDefault("approvalCount", 0);
return approvalCount > 0;
};
}
@Bean
public Action entryAction() {
- return (ctx) -> {
- LOGGER.info("Entry " + ctx.getTarget().getId());
- };
+ return ctx -> LOGGER.info("Entry " + ctx
+ .getTarget()
+ .getId());
}
@Bean
public Action doAction() {
- return (ctx) -> {
- LOGGER.info("Do " + ctx.getTarget().getId());
- };
+ return ctx -> LOGGER.info("Do " + ctx
+ .getTarget()
+ .getId());
}
@Bean
public Action executeAction() {
- return (ctx) -> {
- LOGGER.info("Execute " + ctx.getTarget().getId());
- int approvals = (int) ctx.getExtendedState().getVariables().getOrDefault("approvalCount", 0);
+ return ctx -> {
+ LOGGER.info("Execute " + ctx
+ .getTarget()
+ .getId());
+ int approvals = (int) ctx
+ .getExtendedState()
+ .getVariables()
+ .getOrDefault("approvalCount", 0);
approvals++;
- ctx.getExtendedState().getVariables().put("approvalCount", approvals);
+ ctx
+ .getExtendedState()
+ .getVariables()
+ .put("approvalCount", approvals);
};
}
@Bean
public Action exitAction() {
- return (ctx) -> {
- LOGGER.info("Exit " + ctx.getSource().getId() + " -> " + ctx.getTarget().getId());
- };
+ return ctx -> LOGGER.info("Exit " + ctx
+ .getSource()
+ .getId() + " -> " + ctx
+ .getTarget()
+ .getId());
}
@Bean
public Action errorAction() {
- return (ctx) -> {
- LOGGER.info("Error " + ctx.getSource().getId() + ctx.getException());
- };
+ return ctx -> LOGGER.info("Error " + ctx
+ .getSource()
+ .getId() + ctx.getException());
}
@Bean
public Action initAction() {
- return (ctx) -> {
- LOGGER.info(ctx.getTarget().getId());
- };
+ return ctx -> LOGGER.info(ctx
+ .getTarget()
+ .getId());
}
}
\ No newline at end of file
diff --git a/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/ForkJoinStateMachineTest.java b/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/ForkJoinStateMachineTest.java
index 0de61da3bd..a9aca82a6e 100644
--- a/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/ForkJoinStateMachineTest.java
+++ b/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/ForkJoinStateMachineTest.java
@@ -6,6 +6,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.statemachine.StateMachine;
import org.springframework.test.context.ContextConfiguration;
@@ -21,7 +22,7 @@ import static org.junit.Assert.assertTrue;
@ContextConfiguration(classes = ForkJoinStateMachineConfiguration.class)
public class ForkJoinStateMachineTest {
- @Resource
+ @Autowired
private StateMachine stateMachine;
@Before
diff --git a/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/HierarchicalStateMachineTest.java b/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/HierarchicalStateMachineTest.java
index 76105368d8..a2fa4f9160 100644
--- a/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/HierarchicalStateMachineTest.java
+++ b/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/HierarchicalStateMachineTest.java
@@ -6,6 +6,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.statemachine.StateMachine;
import org.springframework.test.context.ContextConfiguration;
@@ -20,7 +21,7 @@ import static org.junit.Assert.assertEquals;
@ContextConfiguration(classes = HierarchicalStateMachineConfiguration.class)
public class HierarchicalStateMachineTest {
- @Resource
+ @Autowired
private StateMachine stateMachine;
@Before
diff --git a/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/JunctionStateMachineTest.java b/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/JunctionStateMachineTest.java
index b91e6af5c5..2b5130ab45 100644
--- a/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/JunctionStateMachineTest.java
+++ b/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/JunctionStateMachineTest.java
@@ -7,6 +7,7 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.statemachine.StateMachine;
import org.springframework.test.context.ContextConfiguration;
@@ -18,7 +19,7 @@ import javax.annotation.Resource;
@ContextConfiguration(classes = JunctionStateMachineConfiguration.class)
public class JunctionStateMachineTest {
- @Resource
+ @Autowired
private StateMachine stateMachine;
@Before
diff --git a/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/StateEnumMachineTest.java b/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/StateEnumMachineTest.java
index cd9e58eb8e..19f24ede2d 100644
--- a/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/StateEnumMachineTest.java
+++ b/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/StateEnumMachineTest.java
@@ -8,6 +8,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.statemachine.StateMachine;
import org.springframework.test.context.ContextConfiguration;
@@ -22,7 +23,7 @@ import static org.junit.Assert.assertTrue;
@ContextConfiguration(classes = SimpleEnumStateMachineConfiguration.class)
public class StateEnumMachineTest {
- @Resource
+ @Autowired
private StateMachine stateMachine;
@Before
diff --git a/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/StateMachineIntegrationTest.java b/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/StateMachineIntegrationTest.java
index 1c1ab58917..25df7c8cd3 100644
--- a/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/StateMachineIntegrationTest.java
+++ b/spring-state-machine/src/test/java/com/baeldung/spring/statemachine/StateMachineIntegrationTest.java
@@ -7,6 +7,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.statemachine.StateMachine;
@@ -21,7 +22,7 @@ import javax.annotation.Resource;
@ContextConfiguration(classes = SimpleStateMachineConfiguration.class)
public class StateMachineIntegrationTest {
- @Resource
+ @Autowired
private StateMachine stateMachine;
@Before
diff --git a/vertx/src/main/java/com/baledung/rest/RestServiceVerticle.java b/vertx/src/main/java/com/baeldung/rest/RestServiceVerticle.java
similarity index 97%
rename from vertx/src/main/java/com/baledung/rest/RestServiceVerticle.java
rename to vertx/src/main/java/com/baeldung/rest/RestServiceVerticle.java
index 802f74942e..1517a2f943 100644
--- a/vertx/src/main/java/com/baledung/rest/RestServiceVerticle.java
+++ b/vertx/src/main/java/com/baeldung/rest/RestServiceVerticle.java
@@ -1,4 +1,4 @@
-package com.baledung.rest;
+package com.baeldung.rest;
import com.baeldung.model.Article;
diff --git a/vertx/src/main/conf/conf.json b/vertx/src/main/resources/conf/conf.json
similarity index 100%
rename from vertx/src/main/conf/conf.json
rename to vertx/src/main/resources/conf/conf.json
diff --git a/vertx/src/resources/logback.xml b/vertx/src/main/resources/logback.xml
similarity index 100%
rename from vertx/src/resources/logback.xml
rename to vertx/src/main/resources/logback.xml
diff --git a/vertx/src/test/java/com/baeldung/RestServiceVerticleIntegrationTest.java b/vertx/src/test/java/com/baeldung/RestServiceVerticleIntegrationTest.java
index f08d9ffde1..40fa6c7220 100644
--- a/vertx/src/test/java/com/baeldung/RestServiceVerticleIntegrationTest.java
+++ b/vertx/src/test/java/com/baeldung/RestServiceVerticleIntegrationTest.java
@@ -5,7 +5,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import com.baledung.rest.RestServiceVerticle;
+import com.baeldung.rest.RestServiceVerticle;
import io.vertx.core.Vertx;
import io.vertx.ext.unit.Async;