Commit 8d4939af authored by Szabolcs Gyurko's avatar Szabolcs Gyurko
Browse files

Refactored configuration preperties beans

parent c9bafe3a
Pipeline #286 failed with stage
in 1 minute and 43 seconds
......@@ -30,7 +30,6 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
......@@ -40,7 +39,6 @@ import org.springframework.security.config.annotation.method.configuration.Enabl
* Created by Szabolcs Gyurko on 29/06/2018.
*/
@SpringBootApplication
@EnableConfigurationProperties
@EnableGlobalMethodSecurity(
prePostEnabled = true,
securedEnabled = true,
......
......@@ -26,13 +26,13 @@ package com.jeff_cms.jeff.idm.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
/**
* Configuration class used for creating entities.
*/
@Configuration
@ConfigurationProperties(prefix = "jeff-idm")
@Component
@Data
public class AuthorisationConfiguration {
private String allowedGrantTypes;
......
......@@ -49,7 +49,8 @@ public class ClientManagement {
private final OAuthClientDetailsRepository oAuthClientDetailsRepository;
private final ConversionService conversionService;
public ClientManagement(OAuthClientDetailsRepository oAuthClientDetailsRepository, ConversionService conversionService) {
public ClientManagement(final OAuthClientDetailsRepository oAuthClientDetailsRepository,
final ConversionService conversionService) {
this.oAuthClientDetailsRepository = oAuthClientDetailsRepository;
this.conversionService = conversionService;
}
......@@ -62,7 +63,7 @@ public class ClientManagement {
*/
@PostMapping("/")
@Transactional
public ResponseEntity<String> addClient(@Valid @RequestBody Client client, BindingResult bindingResult) {
public ResponseEntity<String> addClient(@Valid @RequestBody final Client client, final BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResponseEntity.badRequest().build();
}
......@@ -84,7 +85,7 @@ public class ClientManagement {
* @return Client
*/
@GetMapping("/{id}")
public ResponseEntity<Client> getClient(@PathVariable String id) {
public ResponseEntity<Client> getClient(@PathVariable final String id) {
final OAuthClientDetails oAuthClientDetails = oAuthClientDetailsRepository.findByClientId(id);
if (oAuthClientDetails == null) {
......
......@@ -45,7 +45,7 @@ import java.net.URI;
public class UserManagement {
private final UserRepository userRepository;
public UserManagement(UserRepository userRepository) {
public UserManagement(final UserRepository userRepository) {
this.userRepository = userRepository;
}
......@@ -55,7 +55,7 @@ public class UserManagement {
* @return User details
*/
@GetMapping("/{id}")
public ResponseEntity<UserDetails> getUser(@PathVariable String id) {
public ResponseEntity<UserDetails> getUser(@PathVariable final String id) {
UserDetails user = userRepository.findByUsername(id);
if (user == null) {
return ResponseEntity.notFound().build();
......@@ -72,7 +72,7 @@ public class UserManagement {
*/
@PostMapping("/")
@Transactional
public ResponseEntity<String> addUser(@Valid @RequestBody UserDetails user, BindingResult bindingResult) {
public ResponseEntity<String> addUser(@Valid @RequestBody final UserDetails user, final BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResponseEntity.badRequest().build();
}
......
......@@ -37,12 +37,12 @@ import org.springframework.stereotype.Component;
public class ClientToOAuthClientDetailsConverter implements Converter<Client, OAuthClientDetails> {
private final AuthorisationConfiguration authorisationConfiguration;
public ClientToOAuthClientDetailsConverter(AuthorisationConfiguration authorisationConfiguration) {
public ClientToOAuthClientDetailsConverter(final AuthorisationConfiguration authorisationConfiguration) {
this.authorisationConfiguration = authorisationConfiguration;
}
@Override
public OAuthClientDetails convert(Client client) {
public OAuthClientDetails convert(final Client client) {
OAuthClientDetails result = new OAuthClientDetails();
result.setClientId(client.getClientId());
......
......@@ -35,7 +35,7 @@ import org.springframework.stereotype.Component;
@Component
public class OAuthClientDetailsToClientConverter implements Converter<OAuthClientDetails, Client> {
@Override
public Client convert(OAuthClientDetails oAuthClientDetails) {
public Client convert(final OAuthClientDetails oAuthClientDetails) {
Client result = new Client();
result.setClientId(oAuthClientDetails.getClientId());
......
......@@ -41,12 +41,12 @@ import java.util.stream.Collectors;
public class H2UserDetailsService implements UserDetailsService {
private final UserRepository userRepository;
public H2UserDetailsService(UserRepository userRepository) {
public H2UserDetailsService(final UserRepository userRepository) {
this.userRepository = userRepository;
}
@Override
public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException {
UserDetails user = userRepository.findByUsername(username);
if (user == null) {
throw new UsernameNotFoundException(username);
......
......@@ -30,7 +30,6 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
......@@ -39,7 +38,6 @@ import org.springframework.core.annotation.Order;
* Created by Szabolcs Gyurko on 29/06/2018.
*/
@SpringBootApplication
@EnableConfigurationProperties
@Slf4j
public class Application extends SpringBootServletInitializer {
/**
......
......@@ -26,13 +26,13 @@ package com.jeff_cms.jeff.node.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
/**
* Model backing executor properties.
*/
@ConfigurationProperties(prefix = "executor")
@Configuration
@Component
@Data
public class ExecutorConfiguration {
private int corePoolSize;
......
......@@ -26,12 +26,12 @@ package com.jeff_cms.jeff.node.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
/**
* Configuration class containing JCR properties.
*/
@Configuration
@Component
@ConfigurationProperties(prefix = "jcr")
@Data
public class JCRConfiguration {
......
......@@ -26,13 +26,13 @@ package com.jeff_cms.jeff.node.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
/**
* Configuration mapping file for MQ specific parameters.
*/
@ConfigurationProperties(prefix = "mq")
@Configuration
@Component
@Data
public class MQConfiguration {
private String queue;
......
......@@ -26,7 +26,7 @@ package com.jeff_cms.jeff.node.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import java.net.URL;
import java.util.List;
......@@ -34,7 +34,7 @@ import java.util.List;
/**
* Configuration class containing node properties.
*/
@Configuration
@Component
@ConfigurationProperties(prefix = "jeff-node")
@Data
public class NodeConfiguration {
......
.lol {
background: #f34565;
}
......@@ -30,7 +30,6 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
......@@ -39,7 +38,6 @@ import org.springframework.core.annotation.Order;
* Created by Szabolcs Gyurko on 29/06/2018.
*/
@SpringBootApplication
@EnableConfigurationProperties
@Slf4j
public class Application extends SpringBootServletInitializer {
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment