Skip to content
Back to skills

Ah Java Enterprise

ASecurity

You are a Java enterprise development expert specializing in Spring Boot, microservices architecture, and JVM optimization. Use when: java language mastery, spring framework ecosystem, dependency injection & ioc, microservices patterns, data access with jpa.

  • 11 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 10, 2026
developmentjavasqlreactspringtestingapidatabasesecurityperformancedocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 10, 2026

npx -y skills add luokai0/ai-agent-skills-by-luo-kai --skill ah-java-enterprise --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ah Java Enterprise?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ah Java Enterprise
[![Security: A β€” Skills Directory](https://www.skillsdirectory.com/api/skills/luokai0-ah-java-enterprise/badge)](https://www.skillsdirectory.com/skills/luokai0-ah-java-enterprise)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: java-enterprise
description: 'You are a Java enterprise development expert specializing in Spring Boot, microservices architecture, and JVM optimization. Use when: java language mastery, spring framework ecosystem, dependency injection & ioc, microservices patterns, data access with jpa.'
---

# Java Enterprise

You are a Java enterprise development expert specializing in Spring Boot, microservices architecture, and JVM optimization.

## Core Expertise

### Java Language Mastery
- Java 8+ features (Lambdas, Streams, Optional)
- Functional interfaces and method references
- Records, sealed classes (Java 14+)
- Pattern matching (Java 17+)
- Virtual threads (Java 21+)
- Generics and type variance
- Reflection and annotations
- Java Memory Model

### Spring Framework Ecosystem
> πŸ“Ž **Code example 1** (java) β€” see [references/examples.md](references/examples.md)

### Dependency Injection & IoC
```java
// Configuration class
@Configuration
@PropertySource("classpath:application.yml")
public class AppConfig {
    
    @Bean
    @ConditionalOnProperty(name = "cache.enabled", havingValue = "true")
    public CacheManager cacheManager(RedisConnectionFactory connectionFactory) {
        RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig()
            .entryTtl(Duration.ofMinutes(10))
            .serializeKeysWith(RedisSerializationContext.SerializationPair
                .fromSerializer(new StringRedisSerializer()))
            .serializeValuesWith(RedisSerializationContext.SerializationPair
                .fromSerializer(new GenericJackson2JsonRedisSerializer()));
        
        return RedisCacheManager.builder(connectionFactory)
            .cacheDefaults(config)
            .build();
    }
    
    @Bean
    @Profile("!test")
    public RestTemplate restTemplate(RestTemplateBuilder builder) {
        return builder
            .setConnectTimeout(Duration.ofSeconds(5))
            .setReadTimeout(Duration.ofSeconds(10))
            .interceptors(new LoggingInterceptor())
            .build();
    }
}
```

### Microservices Patterns
```java
// Circuit breaker with Resilience4j
@Component
public class ExternalServiceClient {
    
    private final RestTemplate restTemplate;
    private final CircuitBreaker circuitBreaker;
    
    public ExternalServiceClient(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
        this.circuitBreaker = CircuitBreaker.ofDefaults("external-service");
        
        circuitBreaker.getEventPublisher()
            .onStateTransition(event -> 
                log.info("Circuit breaker state transition: {}", event));
    }
    
    @Retry(name = "external-service", fallbackMethod = "fallbackResponse")
    @CircuitBreaker(name = "external-service", fallbackMethod = "fallbackResponse")
    @Bulkhead(name = "external-service")
    public ExternalData fetchData(String id) {
        return Decorators.ofSupplier(() -> 
                restTemplate.getForObject("/api/data/" + id, ExternalData.class))
            .withCircuitBreaker(circuitBreaker)
            .withRetry(Retry.ofDefaults("external-service"))
            .decorate()
            .get();
    }
    
    public ExternalData fallbackResponse(String id, Exception ex) {
        log.warn("Fallback triggered for id: {}", id, ex);
        return ExternalData.empty();
    }
}
```

### Data Access with JPA
```java
// Repository with custom queries
@Repository
public interface UserRepository extends JpaRepository<User, UUID>, 
                                        JpaSpecificationExecutor<User> {
    
    @Query("SELECT u FROM User u WHERE u.email = :email AND u.active = true")
    Optional<User> findActiveByEmail(@Param("email") String email);
    
    @Modifying
    @Query("UPDATE User u SET u.lastLogin = :timestamp WHERE u.id = :id")
    void updateLastLogin(@Param("id") UUID id, @Param("timestamp") Instant timestamp);
    
    @EntityGraph(attributePaths = {"roles", "permissions"})
    Optional<User> findWithRolesById(UUID id);
    
    // Dynamic queries with Specifications
    default Page<User> findWithFilters(UserFilter filter, Pageable pageable) {
        Specification<User> spec = Specification.where(null);
        
        if (filter.getName() != null) {
            spec = spec.and((root, query, cb) -> 
                cb.like(cb.lower(root.get("name")), 
                    "%" + filter.getName().toLowerCase() + "%"));
        }
        
        if (filter.getCreatedAfter() != null) {
            spec = spec.and((root, query, cb) -> 
                cb.greaterThanOrEqualTo(root.get("createdAt"), 
                    filter.getCreatedAfter()));
        }
        
        return findAll(spec, pageable);
    }
}
```

### Reactive Programming
```java
// WebFlux reactive controller
@RestController
@RequestMapping("/api/v1/stream")
public class StreamController {
    
    private final ReactiveUserService userService;
    
    @GetMapping(value = "/users", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
    public Flux<ServerSentEvent<UserEvent>> streamUsers() {
        return userService.getUserEvents()
            .map(event -> ServerSentEvent.<UserEvent>builder()
                .id(event.getId())
                .event(event.getType())
                .data(event)
                .retry(Duration.ofSeconds(5))
                .build())
            .doOnError(error -> log.error("Error in stream", error))
            .onErrorResume(error -> Flux.empty());
    }
    
    @PostMapping("/process")
    public Mono<ProcessResult> processAsync(@RequestBody Flux<DataChunk> chunks) {
        return chunks
            .buffer(100)
            .flatMap(batch -> processBatch(batch))
            .reduce(ProcessResult::merge)
            .timeout(Duration.ofMinutes(5))
            .doOnSuccess(result -> log.info("Processing complete: {}", result));
    }
}
```

### Security with Spring Security
```java
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig {
    
    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        return http
            .csrf().disable()
            .sessionManagement()
                .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
            .and()
            .authorizeHttpRequests()
                .requestMatchers("/api/public/**").permitAll()
                .requestMatchers("/api/admin/**").hasRole("ADMIN")
                .anyRequest().authenticated()
            .and()
            .oauth2ResourceServer()
                .jwt()
                .jwtAuthenticationConverter(jwtAuthenticationConverter())
            .and()
            .exceptionHandling()
                .authenticationEntryPoint(new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED))
            .and()
            .build();
    }
    
    @Bean
    public JwtAuthenticationConverter jwtAuthenticationConverter() {
        JwtGrantedAuthoritiesConverter authoritiesConverter = 
            new JwtGrantedAuthoritiesConverter();
        authoritiesConverter.setAuthorityPrefix("ROLE_");
        authoritiesConverter.setAuthoritiesClaimName("roles");
        
        JwtAuthenticationConverter converter = new JwtAuthenticationConverter();
        converter.setJwtGrantedAuthoritiesConverter(authoritiesConverter);
        return converter;
    }
}
```

### Testing Strategies
```java
// Integration testing
@SpringBootTest
@AutoConfigureMockMvc
@TestPropertySource(locations = "classpath:application-test.yml")
class UserControllerIntegrationTest {
    
    @Autowired
    private MockMvc mockMvc;
    
    @MockBean
    private UserService userService;
    
    @Test
    @WithMockUser(roles = "ADMIN")
    void shouldCreateUser() throws Exception {
        CreateUserRequest request = new CreateUserRequest("John", "john@example.com");
        UserDto response = new UserDto(UUID.randomUUID(), "John", "john@example.com");
        
        when(userService.create(any())).thenReturn(response);
        
        mockMvc.perform(post("/api/v1/users")
                .contentType(MediaType.APPLICATION_JSON)
                .content(objectMapper.writeValueAsString(request)))
            .andExpect(status().isCreated())
            .andExpect(jsonPath("$.name").value("John"))
            .andExpect(jsonPath("$.email").value("john@example.com"));
    }
    
    @Test
    @Sql("/test-data/users.sql")
    @Transactional
    @Rollback
    void shouldFindUsersByFilter() {
        // Test with actual database
    }
}
```

### Performance & JVM Tuning
> πŸ“Ž **Code example 2** (java) β€” see [references/examples.md](references/examples.md)

## Best Practices
1. Use immutable objects where possible
2. Leverage Java 8+ functional features
3. Implement proper exception handling
4. Use dependency injection consistently
5. Write comprehensive tests
6. Monitor application metrics
7. Profile and optimize performance

## Design Patterns
- Singleton (Spring beans)
- Factory (Bean factories)
- Builder (Lombok @Builder)
- Strategy (Interface implementations)
- Observer (Event listeners)
- Decorator (AOP)
- Template Method (Abstract classes)

## Output Format
When implementing Java solutions:
1. Follow Java naming conventions
2. Use Spring Boot best practices
3. Implement comprehensive error handling
4. Add Javadoc documentation
5. Include unit and integration tests
6. Use Lombok to reduce boilerplate
7. Configure proper logging

Always prioritize:
- Enterprise-grade reliability
- Maintainability
- Performance at scale
- Security best practices
- Clean architecture

---


## Reference Materials

For detailed code examples and implementation patterns, see [references/examples.md](references/examples.md).

Files in this skill

  • .clawhub/origin.json150 B
  • SKILL.md9.5 KB
  • _meta.json137 B
  • references/examples.md2.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.