Skip to content

Commit 8d633d6

Browse files
author
Eugen Paraschiv
committed
formatting work
1 parent 5fd8e42 commit 8d633d6

48 files changed

Lines changed: 101 additions & 248 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ public class AttrListener implements ServletContextListener {
99

1010
@Override
1111
public void contextInitialized(ServletContextEvent servletContextEvent) {
12-
servletContextEvent.getServletContext()
13-
.setAttribute("servlet-context-attr", "test");
12+
servletContextEvent.getServletContext().setAttribute("servlet-context-attr", "test");
1413
System.out.println("context init");
1514
}
1615

‎spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ public class EchoServlet extends HttpServlet {
1616
@Override
1717
public void doPost(HttpServletRequest request, HttpServletResponse response) {
1818
try {
19-
Path path = File.createTempFile("echo", "tmp")
20-
.toPath();
19+
Path path = File.createTempFile("echo", "tmp").toPath();
2120
Files.copy(request.getInputStream(), path, StandardCopyOption.REPLACE_EXISTING);
2221
Files.copy(path, response.getOutputStream());
2322
Files.delete(path);

‎spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ public void init(FilterConfig filterConfig) throws ServletException {
1818

1919
@Override
2020
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
21-
servletResponse.getOutputStream()
22-
.print(filterConfig.getInitParameter("msg"));
21+
servletResponse.getOutputStream().print(filterConfig.getInitParameter("msg"));
2322
filterChain.doFilter(servletRequest, servletResponse);
2423
}
2524

‎spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ public void init(ServletConfig servletConfig) {
2121
@Override
2222
public void doGet(HttpServletRequest request, HttpServletResponse response) {
2323
try {
24-
response.getOutputStream()
25-
.write(servletConfig.getInitParameter("msg")
26-
.getBytes());
24+
response.getOutputStream().write(servletConfig.getInitParameter("msg").getBytes());
2725
} catch (IOException e) {
2826
e.printStackTrace();
2927
}

‎spring-boot/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,8 @@ static class HibernateCondition extends SpringBootCondition {
9898
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
9999
ConditionMessage.Builder message = ConditionMessage.forCondition("Hibernate");
100100

101-
return Arrays.stream(CLASS_NAMES)
102-
.filter(className -> ClassUtils.isPresent(className, context.getClassLoader()))
103-
.map(className -> ConditionOutcome.match(message.found("class")
104-
.items(Style.NORMAL, className)))
105-
.findAny()
106-
.orElseGet(() -> ConditionOutcome.noMatch(message.didNotFind("class", "classes")
107-
.items(Style.NORMAL, Arrays.asList(CLASS_NAMES))));
101+
return Arrays.stream(CLASS_NAMES).filter(className -> ClassUtils.isPresent(className, context.getClassLoader())).map(className -> ConditionOutcome.match(message.found("class").items(Style.NORMAL, className))).findAny()
102+
.orElseGet(() -> ConditionOutcome.noMatch(message.didNotFind("class", "classes").items(Style.NORMAL, Arrays.asList(CLASS_NAMES))));
108103
}
109104

110105
}

‎spring-boot/src/main/java/com/baeldung/dynamicvalidation/ContactInfoValidator.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ public void initialize(final ContactInfo contactInfo) {
2828
if (StringUtils.isEmptyOrWhitespace(expressionType)) {
2929
LOG.error("Contact info type missing!");
3030
} else {
31-
pattern = expressionRepository.findOne(expressionType)
32-
.map(ContactInfoExpression::getPattern)
33-
.orElse("");
31+
pattern = expressionRepository.findOne(expressionType).map(ContactInfoExpression::getPattern).orElse("");
3432
}
3533
}
3634

‎spring-boot/src/main/java/com/baeldung/dynamicvalidation/config/PersistenceConfig.java‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ public class PersistenceConfig {
1818
@Bean
1919
public DataSource dataSource() {
2020
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
21-
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2)
22-
.addScript("schema-expressions.sql")
23-
.addScript("data-expressions.sql")
24-
.build();
21+
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2).addScript("schema-expressions.sql").addScript("data-expressions.sql").build();
2522
return db;
2623
}
2724
}

‎spring-boot/src/main/java/com/baeldung/failureanalyzer/MyBeanNotOfRequiredTypeFailureAnalyzer.java‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ protected FailureAnalysis analyze(Throwable rootFailure, BeanNotOfRequiredTypeEx
1212
}
1313

1414
private String getDescription(BeanNotOfRequiredTypeException ex) {
15-
return String.format("The bean %s could not be injected as %s because it is of type %s", ex.getBeanName(), ex.getRequiredType()
16-
.getName(),
17-
ex.getActualType()
18-
.getName());
15+
return String.format("The bean %s could not be injected as %s because it is of type %s", ex.getBeanName(), ex.getRequiredType().getName(), ex.getActualType().getName());
1916
}
2017

2118
private String getAction(BeanNotOfRequiredTypeException ex) {
22-
return String.format("Consider creating a bean with name %s of type %s", ex.getBeanName(), ex.getRequiredType()
23-
.getName());
19+
return String.format("Consider creating a bean with name %s of type %s", ex.getBeanName(), ex.getRequiredType().getName());
2420
}
2521

2622
}

‎spring-boot/src/main/java/com/baeldung/graphql/AuthorDao.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ public AuthorDao(List<Author> authors) {
1111
}
1212

1313
public Optional<Author> getAuthor(String id) {
14-
return authors.stream()
15-
.filter(author -> id.equals(author.getId()))
16-
.findFirst();
14+
return authors.stream().filter(author -> id.equals(author.getId())).findFirst();
1715
}
1816
}

‎spring-boot/src/main/java/com/baeldung/graphql/Mutation.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ public Mutation(PostDao postDao) {
1313

1414
public Post writePost(String title, String text, String category, String author) {
1515
Post post = new Post();
16-
post.setId(UUID.randomUUID()
17-
.toString());
16+
post.setId(UUID.randomUUID().toString());
1817
post.setTitle(title);
1918
post.setText(text);
2019
post.setCategory(category);

0 commit comments

Comments
 (0)