Polish
This commit is contained in:
parent
d0a4e49870
commit
875aae012b
|
@ -73,24 +73,24 @@ public class ReactiveUserDetailsServiceResourceFactoryBean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a UserDetailsRepositoryResourceFactoryBean with the location of a Resource that is a Properties file in the
|
* Create a ReactiveUserDetailsServiceResourceFactoryBean with the location of a Resource that is a Properties file in the
|
||||||
* format defined in {@link UserDetailsResourceFactoryBean}
|
* format defined in {@link UserDetailsResourceFactoryBean}.
|
||||||
*
|
*
|
||||||
* @param resourceLocatiton the location of the properties file that contains the users (i.e. "classpath:users.properties")
|
* @param resourceLocation the location of the properties file that contains the users (i.e. "classpath:users.properties")
|
||||||
* @return the UserDetailsResourceFactoryBean
|
* @return the ReactiveUserDetailsServiceResourceFactoryBean
|
||||||
*/
|
*/
|
||||||
public static ReactiveUserDetailsServiceResourceFactoryBean fromResourceLocation(String resourceLocatiton) {
|
public static ReactiveUserDetailsServiceResourceFactoryBean fromResourceLocation(String resourceLocation) {
|
||||||
ReactiveUserDetailsServiceResourceFactoryBean result = new ReactiveUserDetailsServiceResourceFactoryBean();
|
ReactiveUserDetailsServiceResourceFactoryBean result = new ReactiveUserDetailsServiceResourceFactoryBean();
|
||||||
result.setResourceLocation(resourceLocatiton);
|
result.setResourceLocation(resourceLocation);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a UserDetailsRepositoryResourceFactoryBean with a Resource that is a Properties file in the
|
* Create a ReactiveUserDetailsServiceResourceFactoryBean with a Resource that is a Properties file in the
|
||||||
* format defined in {@link UserDetailsResourceFactoryBean}
|
* format defined in {@link UserDetailsResourceFactoryBean}.
|
||||||
*
|
*
|
||||||
* @param propertiesResource the Resource that is a properties file that contains the users
|
* @param propertiesResource the Resource that is a properties file that contains the users
|
||||||
* @return the UserDetailsResourceFactoryBean
|
* @return the ReactiveUserDetailsServiceResourceFactoryBean
|
||||||
*/
|
*/
|
||||||
public static ReactiveUserDetailsServiceResourceFactoryBean fromResource(Resource propertiesResource) {
|
public static ReactiveUserDetailsServiceResourceFactoryBean fromResource(Resource propertiesResource) {
|
||||||
ReactiveUserDetailsServiceResourceFactoryBean result = new ReactiveUserDetailsServiceResourceFactoryBean();
|
ReactiveUserDetailsServiceResourceFactoryBean result = new ReactiveUserDetailsServiceResourceFactoryBean();
|
||||||
|
@ -99,11 +99,11 @@ public class ReactiveUserDetailsServiceResourceFactoryBean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a UserDetailsRepositoryResourceFactoryBean with a String that is in the
|
* Create a ReactiveUserDetailsServiceResourceFactoryBean with a String that is in the
|
||||||
* format defined in {@link UserDetailsResourceFactoryBean}
|
* format defined in {@link UserDetailsResourceFactoryBean}.
|
||||||
*
|
*
|
||||||
* @param users the users in the format defined in {@link UserDetailsResourceFactoryBean}
|
* @param users the users in the format defined in {@link UserDetailsResourceFactoryBean}
|
||||||
* @return the UserDetailsResourceFactoryBean
|
* @return the ReactiveUserDetailsServiceResourceFactoryBean
|
||||||
*/
|
*/
|
||||||
public static ReactiveUserDetailsServiceResourceFactoryBean fromString(String users) {
|
public static ReactiveUserDetailsServiceResourceFactoryBean fromString(String users) {
|
||||||
ReactiveUserDetailsServiceResourceFactoryBean result = new ReactiveUserDetailsServiceResourceFactoryBean();
|
ReactiveUserDetailsServiceResourceFactoryBean result = new ReactiveUserDetailsServiceResourceFactoryBean();
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class UserDetailsResourceFactoryBean implements ResourceLoaderAware, Fact
|
||||||
@Override
|
@Override
|
||||||
public Collection<UserDetails> getObject() throws Exception {
|
public Collection<UserDetails> getObject() throws Exception {
|
||||||
Properties userProperties = new Properties();
|
Properties userProperties = new Properties();
|
||||||
Resource resource = getProperitesResource();
|
Resource resource = getPropertiesResource();
|
||||||
try(InputStream in = resource.getInputStream()){
|
try(InputStream in = resource.getInputStream()){
|
||||||
userProperties.load(in);
|
userProperties.load(in);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public class UserDetailsResourceFactoryBean implements ResourceLoaderAware, Fact
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Resource getProperitesResource() {
|
private Resource getPropertiesResource() {
|
||||||
Resource result = resource;
|
Resource result = resource;
|
||||||
if(result == null && resourceLocation != null) {
|
if(result == null && resourceLocation != null) {
|
||||||
result = resourceLoader.getResource(resourceLocation);
|
result = resourceLoader.getResource(resourceLocation);
|
||||||
|
@ -129,20 +129,20 @@ public class UserDetailsResourceFactoryBean implements ResourceLoaderAware, Fact
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a UserDetailsResourceFactoryBean with the location of a Resource that is a Properties file in the
|
* Create a UserDetailsResourceFactoryBean with the location of a Resource that is a Properties file in the
|
||||||
* format defined in {@link UserDetailsResourceFactoryBean}
|
* format defined in {@link UserDetailsResourceFactoryBean}.
|
||||||
*
|
*
|
||||||
* @param resourceLocatiton the location of the properties file that contains the users (i.e. "classpath:users.properties")
|
* @param resourceLocation the location of the properties file that contains the users (i.e. "classpath:users.properties")
|
||||||
* @return the UserDetailsResourceFactoryBean
|
* @return the UserDetailsResourceFactoryBean
|
||||||
*/
|
*/
|
||||||
public static UserDetailsResourceFactoryBean fromResourceLocation(String resourceLocatiton) {
|
public static UserDetailsResourceFactoryBean fromResourceLocation(String resourceLocation) {
|
||||||
UserDetailsResourceFactoryBean result = new UserDetailsResourceFactoryBean();
|
UserDetailsResourceFactoryBean result = new UserDetailsResourceFactoryBean();
|
||||||
result.setResourceLocation(resourceLocatiton);
|
result.setResourceLocation(resourceLocation);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a UserDetailsResourceFactoryBean with a Resource that is a Properties file in the
|
* Create a UserDetailsResourceFactoryBean with a Resource that is a Properties file in the
|
||||||
* format defined in {@link UserDetailsResourceFactoryBean}
|
* format defined in {@link UserDetailsResourceFactoryBean}.
|
||||||
*
|
*
|
||||||
* @param propertiesResource the Resource that is a properties file that contains the users
|
* @param propertiesResource the Resource that is a properties file that contains the users
|
||||||
* @return the UserDetailsResourceFactoryBean
|
* @return the UserDetailsResourceFactoryBean
|
||||||
|
|
|
@ -57,7 +57,6 @@ public class UserDetailsManagerResourceFactoryBean implements ResourceLoaderAwar
|
||||||
* Sets the location of a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}.
|
* Sets the location of a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}.
|
||||||
*
|
*
|
||||||
* @param resourceLocation the location of the properties file that contains the users (i.e. "classpath:users.properties")
|
* @param resourceLocation the location of the properties file that contains the users (i.e. "classpath:users.properties")
|
||||||
* @return the UserDetailsResourceFactoryBean
|
|
||||||
*/
|
*/
|
||||||
public void setResourceLocation(String resourceLocation) {
|
public void setResourceLocation(String resourceLocation) {
|
||||||
this.userDetails.setResourceLocation(resourceLocation);
|
this.userDetails.setResourceLocation(resourceLocation);
|
||||||
|
@ -73,11 +72,11 @@ public class UserDetailsManagerResourceFactoryBean implements ResourceLoaderAwar
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a UserDetailsServiceResourceFactoryBean with the location of a Resource that is a Properties file in the
|
* Create a UserDetailsManagerResourceFactoryBean with the location of a Resource that is a Properties file in the
|
||||||
* format defined in {@link UserDetailsResourceFactoryBean}
|
* format defined in {@link UserDetailsResourceFactoryBean}.
|
||||||
*
|
*
|
||||||
* @param resourceLocation the location of the properties file that contains the users (i.e. "classpath:users.properties")
|
* @param resourceLocation the location of the properties file that contains the users (i.e. "classpath:users.properties")
|
||||||
* @return the UserDetailsResourceFactoryBean
|
* @return the UserDetailsManagerResourceFactoryBean
|
||||||
*/
|
*/
|
||||||
public static UserDetailsManagerResourceFactoryBean fromResourceLocation(String resourceLocation) {
|
public static UserDetailsManagerResourceFactoryBean fromResourceLocation(String resourceLocation) {
|
||||||
UserDetailsManagerResourceFactoryBean result = new UserDetailsManagerResourceFactoryBean();
|
UserDetailsManagerResourceFactoryBean result = new UserDetailsManagerResourceFactoryBean();
|
||||||
|
@ -86,11 +85,11 @@ public class UserDetailsManagerResourceFactoryBean implements ResourceLoaderAwar
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a UserDetailsServiceResourceFactoryBean with a Resource that is a Properties file in the
|
* Create a UserDetailsManagerResourceFactoryBean with a Resource that is a Properties file in the
|
||||||
* format defined in {@link UserDetailsResourceFactoryBean}
|
* format defined in {@link UserDetailsResourceFactoryBean}.
|
||||||
*
|
*
|
||||||
* @param resource the Resource that is a properties file that contains the users
|
* @param resource the Resource that is a properties file that contains the users
|
||||||
* @return the UserDetailsResourceFactoryBean
|
* @return the UserDetailsManagerResourceFactoryBean
|
||||||
*/
|
*/
|
||||||
public static UserDetailsManagerResourceFactoryBean fromResource(Resource resource) {
|
public static UserDetailsManagerResourceFactoryBean fromResource(Resource resource) {
|
||||||
UserDetailsManagerResourceFactoryBean result = new UserDetailsManagerResourceFactoryBean();
|
UserDetailsManagerResourceFactoryBean result = new UserDetailsManagerResourceFactoryBean();
|
||||||
|
@ -99,11 +98,11 @@ public class UserDetailsManagerResourceFactoryBean implements ResourceLoaderAwar
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a UserDetailsServiceResourceFactoryBean with a String that is in the
|
* Create a UserDetailsManagerResourceFactoryBean with a String that is in the
|
||||||
* format defined in {@link UserDetailsResourceFactoryBean}
|
* format defined in {@link UserDetailsResourceFactoryBean}.
|
||||||
*
|
*
|
||||||
* @param users the users in the format defined in {@link UserDetailsResourceFactoryBean}
|
* @param users the users in the format defined in {@link UserDetailsResourceFactoryBean}
|
||||||
* @return the UserDetailsResourceFactoryBean
|
* @return the UserDetailsManagerResourceFactoryBean
|
||||||
*/
|
*/
|
||||||
public static UserDetailsManagerResourceFactoryBean fromString(String users) {
|
public static UserDetailsManagerResourceFactoryBean fromString(String users) {
|
||||||
UserDetailsManagerResourceFactoryBean result = new UserDetailsManagerResourceFactoryBean();
|
UserDetailsManagerResourceFactoryBean result = new UserDetailsManagerResourceFactoryBean();
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class ReactiveUserDetailsServiceResourceFactoryBeanStringITests {
|
||||||
@Autowired ReactiveUserDetailsService users;
|
@Autowired ReactiveUserDetailsService users;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadUserByUsernameWhenUserFoundThenNotNull() {
|
public void findByUsernameWhenUserFoundThenNotNull() {
|
||||||
assertThat(users.findByUsername("user").block()).isNotNull();
|
assertThat(users.findByUsername("user").block()).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue