Error creating bean with name 'messageController': Unsatisfied dependency expressed through field 'dbBundleService':
No qualifying bean of type 'com.valora.dbbundle.service.DbBundleService' available
Spring Boot 3.x+ kullanıyorsanız, kütüphanenin doğru auto-configuration dosyasına sahip olduğundan emin olun:
Kontrol:
# JAR içeriğini kontrol edin
jar -tf dbbundle-1.0.0.jar | grep AutoConfiguration.imports
Olması gereken:
META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
DbBundleService, MessageRepository’ye ihtiyaç duyar. Uygulamanızda şunları oluşturduğunuzdan emin olun:
Entity:
@Entity
@Table(name = "messages")
public class Message implements MessageEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "msg_key")
private String msgKey;
@Column(name = "msg_value")
private String msgValue;
@Column(name = "locale_code")
private String localeCode;
// Getter metodlarını implement edin
@Override
public String getMsgKey() { return msgKey; }
@Override
public String getMsgValue() { return msgValue; }
@Override
public String getLocaleCode() { return localeCode; }
// Setters...
}
Repository:
@Repository
public interface MessageJpaRepository extends JpaRepository<Message, Long>, MessageRepository {
@Override
List<Message> findByLocaleCode(String localeCode);
@Override
Message findByMsgKeyAndLocaleCode(String msgKey, String localeCode);
}
Main Application sınıfınıza annotation ekleyin:
@SpringBootApplication
@EntityScan(basePackages = {"com.yourpackage.entity", "com.valora.dbbundle.model"})
@EnableJpaRepositories(basePackages = {"com.yourpackage.repository", "com.valora.dbbundle.repository"})
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Eğer auto-configuration çalışmazsa, manuel olarak bean tanımlayabilirsiniz:
@Configuration
public class DbBundleManualConfig {
@Bean
public DbBundleService dbBundleService(MessageRepository messageRepository) {
DbBundleService service = new DbBundleService(messageRepository);
service.init();
return service;
}
@Bean
public ValoraBundleAnnotationProcessor valoraBundleAnnotationProcessor(DbBundleService service) {
return new ValoraBundleAnnotationProcessor(service);
}
}
pom.xml’de dependency doğru eklenmiş mi?
<dependency>
<groupId>com.valora</groupId>
<artifactId>dbbundle</artifactId>
<version>1.0.0</version>
</dependency>
Maven’i yeniden build edin:
mvn clean install
spring.jpa.hibernate.ddl-auto=update
CREATE TABLE messages (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
msg_key VARCHAR(255) NOT NULL,
msg_value TEXT NOT NULL,
locale_code VARCHAR(10) NOT NULL,
UNIQUE KEY unique_key_locale (msg_key, locale_code)
);
JSF sayfalarında #{msg['key']} çalışmıyor veya ???key??? gösteriyor.
src/main/webapp/WEB-INF/faces-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
version="2.3">
<application>
<!-- ÖNEMLİ: JsfMessageELResolver kullanın (JDK 24 için) -->
<el-resolver>com.valora.dbbundle.el.JsfMessageELResolver</el-resolver>
</application>
</faces-config>
Uygulama başlatıldığında log’larda şunu arayın:
INFO : Creating DbBundleService bean
INFO : DbBundleService configured for JSF EL Resolver
Eğer görmüyorsanız, MessageRepository bean’i eksik olabilir.
v1.0.0-fixed sürümünü kullandığınızdan emin olun:
JsfMessageELResolver → JSF için (javax.el.ELResolver)MessageELResolver → Jakarta EL için (jakarta.el.ELResolver)faces-config.xml’de JsfMessageELResolver kullanmalısınız.
Detaylı JSF entegrasyonu için JSF-INTEGRATION.md dosyasına bakın.
Type mismatch: cannot convert from jakarta.el.ELResolver to javax.el.ELResolver
DbBundle v1.0.0-fixed sürümünde bu sorun çözülmüştür:
javax.el) - JSF uygulamaları içinjakarta.el) - Modern Jakarta EE içinfaces-config.xml’de doğru sınıfı kullanın:
<el-resolver>com.valora.dbbundle.el.JsfMessageELResolver</el-resolver>
## ❌ Cache Çalışmıyor
### Debug Mode Açın
```properties
logging.level.com.valora.dbbundle=DEBUG
@Autowired
private DbBundleService dbBundleService;
public void checkCache() {
String stats = dbBundleService.getCacheStats();
System.out.println("Cache Stats: " + stats);
}
@Service // veya @Component, @Controller
public class MyService {
@ValoraBundle
private ResourceBundle bundle;
}
@ValoraBundle private DbBundleService bundle; // ❌ Yanlış
3. **ValoraBundleAnnotationProcessor Bean'i var mı?**
```bash
# Application başlatırken log'larda şunu arayın:
"Creating ValoraBundleAnnotationProcessor bean"
@Autowired
private DbBundleService dbBundleService;
public void changeLanguage(String localeCode) {
// Önce locale'i değiştir
dbBundleService.changeLocale(localeCode);
// Yeni ResourceBundle'ı al
ResourceBundle bundle = dbBundleService.getBundle();
// Test et
String message = bundle.getString("test.key");
System.out.println(message);
}
Bu, message key’in veritabanında bulunamadığı anlamına gelir.
SELECT * FROM messages WHERE msg_key = 'your.key' AND locale_code = 'tr';
String msg = dbBundleService.getMessage("test.key");
// Eğer "???test.key???" dönerse, key veritabanında yok
# application.properties
logging.level.com.valora.dbbundle=DEBUG
logging.level.org.springframework.boot.autoconfigure=DEBUG
logging.level.org.hibernate.SQL=DEBUG
cd dbbundle
mvn clean install -U
IDE’yi Restart Edin
cd your-project
mvn clean
Sorununuz devam ediyorsa: